Date: (Sat) Jun 11, 2016
Data: Source: Training: “https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/train2016.csv”
New: “https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/test2016.csv”
Time period:
Based on analysis utilizing <> techniques,
Summary of key steps & error improvement stats:
Use plot.ly for interactive plots ?
varImp for randomForest crashes in caret version:6.0.41 -> submit bug report
extensions toward multiclass classification are scheduled for the next release
rm(list = ls())
set.seed(12345)
options(stringsAsFactors = FALSE)
source("~/Dropbox/datascience/R/mycaret.R")
source("~/Dropbox/datascience/R/mypetrinet.R")
source("~/Dropbox/datascience/R/myplclust.R")
source("~/Dropbox/datascience/R/myplot.R")
source("~/Dropbox/datascience/R/myscript.R")
source("~/Dropbox/datascience/R/mytm.R")
if (is.null(knitr::opts_current$get(name = 'label'))) # Running in IDE
debugSource("~/Dropbox/datascience/R/mydsutils.R") else
source("~/Dropbox/datascience/R/mydsutils.R")
## Loading required package: caret
## Loading required package: lattice
# Gather all package requirements here
suppressPackageStartupMessages(require(doMC))
glbCores <- 10 # of cores on machine - 2
registerDoMC(glbCores)
suppressPackageStartupMessages(require(caret))
require(plyr)
## Loading required package: plyr
require(dplyr)
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
require(knitr)
## Loading required package: knitr
require(stringr)
## Loading required package: stringr
#source("dbgcaret.R")
#packageVersion("snow")
#require(sos); findFn("cosine", maxPages=2, sortby="MaxScore")
# Analysis control global variables
# Inputs
# url/name = "<PathPointer>"; if url specifies a zip file, name = "<filename>";
# or named collection of <PathPointer>s
# sep = choose from c(NULL, "\t")
glbObsTrnFile <- list(url = "https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/train2016.csv"
# or list(url = c(NULL, <.inp1> = "<path1>", <.inp2> = "<path2>"))
#, splitSpecs = list(method = "copy" # default when glbObsNewFile is NULL
# select from c("copy", NULL ???, "condition", "sample", )
# ,nRatio = 0.3 # > 0 && < 1 if method == "sample"
# ,seed = 123 # any integer or glbObsTrnPartitionSeed if method == "sample"
# ,condition = # or 'is.na(<var>)'; '<var> <condition_operator> <value>'
# )
)
glbObsNewFile <- list(url = "https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/test2016.csv")
glbObsDropCondition <- #NULL # : default
# enclose in single-quotes b/c condition might include double qoutes
# use | & ; NOT || &&
# '<condition>'
# 'grepl("^First Draft Video:", glbObsAll$Headline)'
# 'is.na(glbObsAll[, glb_rsp_var_raw])'
# '(is.na(glbObsAll[, glb_rsp_var_raw]) & grepl("Train", glbObsAll[, glbFeatsId]))'
# 'is.na(strptime(glbObsAll[, "Date"], glbFeatsDateTime[["Date"]]["format"], tz = glbFeatsDateTime[["Date"]]["timezone"]))'
'(is.na(glbObsAll[, "Q109244"]) | (glbObsAll[, "Q109244"] != "No"))'
#nrow(do.call("subset",list(glbObsAll, parse(text=paste0("!(", glbObsDropCondition, ")")))))
glb_obs_repartition_train_condition <- NULL # : default
# "<condition>"
glb_max_fitobs <- NULL # or any integer
glbObsTrnPartitionSeed <- 123 # or any integer
glb_is_regression <- FALSE; glb_is_classification <- !glb_is_regression;
glb_is_binomial <- TRUE # or TRUE or FALSE
glb_rsp_var_raw <- "Party"
# for classification, the response variable has to be a factor
glb_rsp_var <- "Party.fctr"
# if the response factor is based on numbers/logicals e.g (0/1 OR TRUE/FALSE vs. "A"/"B"),
# or contains spaces (e.g. "Not in Labor Force")
# caret predict(..., type="prob") crashes
glb_map_rsp_raw_to_var <- #NULL
function(raw) {
# return(raw ^ 0.5)
# return(log(raw))
# return(log(1 + raw))
# return(log10(raw))
# return(exp(-raw / 2))
#
# chk ref value against frequencies vs. alpha sort order
ret_vals <- rep_len(NA, length(raw)); ret_vals[!is.na(raw)] <- ifelse(raw[!is.na(raw)] == "Republican", "R", "D"); return(relevel(as.factor(ret_vals), ref = "D"))
# as.factor(paste0("B", raw))
# as.factor(gsub(" ", "\\.", raw))
}
#if glb_rsp_var_raw is numeric:
#print(summary(glbObsAll[, glb_rsp_var_raw]))
#glb_map_rsp_raw_to_var(tst <- c(NA, as.numeric(summary(glbObsAll[, glb_rsp_var_raw]))))
#if glb_rsp_var_raw is character:
#print(table(glbObsAll[, glb_rsp_var_raw], useNA = "ifany"))
# print(table(glb_map_rsp_raw_to_var(tst <- glbObsAll[, glb_rsp_var_raw]), useNA = "ifany"))
glb_map_rsp_var_to_raw <- #NULL
function(var) {
# return(var ^ 2.0)
# return(exp(var))
# return(10 ^ var)
# return(-log(var) * 2)
# as.numeric(var)
# levels(var)[as.numeric(var)]
sapply(levels(var)[as.numeric(var)], function(elm)
if (is.na(elm)) return(elm) else
if (elm == 'R') return("Republican") else
if (elm == 'D') return("Democrat") else
stop("glb_map_rsp_var_to_raw: unexpected value: ", elm)
)
# gsub("\\.", " ", levels(var)[as.numeric(var)])
# c("<=50K", " >50K")[as.numeric(var)]
# c(FALSE, TRUE)[as.numeric(var)]
}
# print(table(glb_map_rsp_var_to_raw(glb_map_rsp_raw_to_var(tst)), useNA = "ifany"))
if ((glb_rsp_var != glb_rsp_var_raw) && is.null(glb_map_rsp_raw_to_var))
stop("glb_map_rsp_raw_to_var function expected")
# List info gathered for various columns
# <col_name>: <description>; <notes>
# USER_ID - an anonymous id unique to a given user
# YOB - the year of birth of the user
# Gender - the gender of the user, either Male or Female
# Income - the household income of the user. Either not provided, or one of "under $25,000", "$25,001 - $50,000", "$50,000 - $74,999", "$75,000 - $100,000", "$100,001 - $150,000", or "over $150,000".
# HouseholdStatus - the household status of the user. Either not provided, or one of "Domestic Partners (no kids)", "Domestic Partners (w/kids)", "Married (no kids)", "Married (w/kids)", "Single (no kids)", or "Single (w/kids)".
# EducationalLevel - the education level of the user. Either not provided, or one of "Current K-12", "High School Diploma", "Current Undergraduate", "Associate's Degree", "Bachelor's Degree", "Master's Degree", or "Doctoral Degree".
# Party - the political party for whom the user intends to vote for. Either "Democrat" or "Republican
# Q124742, Q124122, . . . , Q96024 - 101 different questions that the users were asked on Show of Hands. If the user didn't answer the question, there is a blank. For information about the question text and possible answers, see the file Questions.pdf.
# currently does not handle more than 1 column; consider concatenating multiple columns
# If glbFeatsId == NULL, ".rownames <- as.numeric(row.names())" is the default
glbFeatsId <- "USER_ID" # choose from c(NULL : default, "<id_feat>")
# glbFeatsCategory <- "Hhold.fctr" # choose from c(NULL : default, "<category_feat>")
glbFeatsCategory <- "Q109244.fctr" # choose from c(NULL : default, "<category_feat>") -> OOB performed worse than "Hhold.fctr"
# User-specified exclusions
glbFeatsExclude <- c(NULL
# Feats that shd be excluded due to known causation by prediction variable
# , "<feat1", "<feat2>"
# Feats that are factors with unique values (as % of nObs) > 49 (empirically derived)
# Feats that are linear combinations (alias in glm)
# Feature-engineering phase -> start by excluding all features except id & category &
# work each one in
, "USER_ID", "YOB", "Gender", "Income", "HouseholdStatus", "EducationLevel"
,"Q124742","Q124122"
,"Q123621","Q123464"
,"Q122771","Q122770","Q122769","Q122120"
,"Q121700","Q121699","Q121011"
,"Q120978","Q120650","Q120472","Q120379","Q120194","Q120014","Q120012"
,"Q119851","Q119650","Q119334"
,"Q118892","Q118237","Q118233","Q118232","Q118117"
,"Q117193","Q117186"
,"Q116797","Q116881","Q116953","Q116601","Q116441","Q116448","Q116197"
,"Q115602","Q115777","Q115610","Q115611","Q115899","Q115390","Q115195"
,"Q114961","Q114748","Q114517","Q114386","Q114152"
,"Q113992","Q113583","Q113584","Q113181"
,"Q112478","Q112512","Q112270"
,"Q111848","Q111580","Q111220"
,"Q110740"
,"Q109367","Q109244"
,"Q108950","Q108855","Q108617","Q108856","Q108754","Q108342","Q108343"
,"Q107869","Q107491"
,"Q106993","Q106997","Q106272","Q106388","Q106389","Q106042"
,"Q105840","Q105655"
,"Q104996"
,"Q103293"
,"Q102906","Q102674","Q102687","Q102289","Q102089"
,"Q101162","Q101163","Q101596"
,"Q100689","Q100680","Q100562","Q100010"
,"Q99982"
,"Q99716"
,"Q99581"
,"Q99480"
,"Q98869"
,"Q98578"
,"Q98197"
,"Q98059","Q98078"
,"Q96024" # Done
,".pos")
if (glb_rsp_var_raw != glb_rsp_var)
glbFeatsExclude <- union(glbFeatsExclude, glb_rsp_var_raw)
glbFeatsInteractionOnly <- list()
#glbFeatsInteractionOnly[["<child_feat>"]] <- "<parent_feat>"
glbFeatsInteractionOnly[["YOB.Age.dff"]] <- "YOB.Age.fctr"
glbFeatsDrop <- c(NULL
# , "<feat1>", "<feat2>"
)
glb_map_vars <- NULL # or c("<var1>", "<var2>")
glb_map_urls <- list();
# glb_map_urls[["<var1>"]] <- "<var1.url>"
# Derived features; Use this mechanism to cleanse data ??? Cons: Data duplication ???
glbFeatsDerive <- list();
# glbFeatsDerive[["<feat.my.sfx>"]] <- list(
# mapfn = function(<arg1>, <arg2>) { return(function(<arg1>, <arg2>)) }
# , args = c("<arg1>", "<arg2>"))
#myprint_df(data.frame(ImageId = mapfn(glbObsAll$.src, glbObsAll$.pos)))
#data.frame(ImageId = mapfn(glbObsAll$.src, glbObsAll$.pos))[7045:7055, ]
# character
# mapfn = function(Education) { raw <- Education; raw[is.na(raw)] <- "NA.my"; return(as.factor(raw)) }
# mapfn = function(Week) { return(substr(Week, 1, 10)) }
# mapfn = function(Name) { return(sapply(Name, function(thsName)
# str_sub(unlist(str_split(thsName, ","))[1], 1, 1))) }
# mapfn = function(descriptor) { return(plyr::revalue(descriptor, c(
# "ABANDONED BUILDING" = "OTHER",
# "**" = "**"
# ))) }
# mapfn = function(description) { mod_raw <- description;
# This is here because it does not work if it's in txt_map_filename
# mod_raw <- gsub(paste0(c("\n", "\211", "\235", "\317", "\333"), collapse = "|"), " ", mod_raw)
# Don't parse for "." because of ".com"; use customized gsub for that text
# mod_raw <- gsub("(\\w)(!|\\*|,|-|/)(\\w)", "\\1\\2 \\3", mod_raw);
# Some state acrnoyms need context for separation e.g.
# LA/L.A. could either be "Louisiana" or "LosAngeles"
# modRaw <- gsub("\\bL\\.A\\.( |,|')", "LosAngeles\\1", modRaw);
# OK/O.K. could either be "Oklahoma" or "Okay"
# modRaw <- gsub("\\bACA OK\\b", "ACA OKay", modRaw);
# modRaw <- gsub("\\bNow O\\.K\\.\\b", "Now OKay", modRaw);
# PR/P.R. could either be "PuertoRico" or "Public Relations"
# modRaw <- gsub("\\bP\\.R\\. Campaign", "PublicRelations Campaign", modRaw);
# VA/V.A. could either be "Virginia" or "VeteransAdministration"
# modRaw <- gsub("\\bthe V\\.A\\.\\:", "the VeteranAffairs:", modRaw);
#
# Custom mods
# return(mod_raw) }
# numeric
# Create feature based on record position/id in data
glbFeatsDerive[[".pos"]] <- list(
mapfn = function(raw1) { return(1:length(raw1)) }
, args = c(".rnorm"))
# glbFeatsDerive[[".pos.y"]] <- list(
# mapfn = function(raw1) { return(1:length(raw1)) }
# , args = c(".rnorm"))
# Add logs of numerics that are not distributed normally
# Derive & keep multiple transformations of the same feature, if normality is hard to achieve with just one transformation
# Right skew: logp1; sqrt; ^ 1/3; logp1(logp1); log10; exp(-<feat>/constant)
# glbFeatsDerive[["WordCount.log1p"]] <- list(
# mapfn = function(WordCount) { return(log1p(WordCount)) }
# , args = c("WordCount"))
# glbFeatsDerive[["WordCount.root2"]] <- list(
# mapfn = function(WordCount) { return(WordCount ^ (1/2)) }
# , args = c("WordCount"))
# glbFeatsDerive[["WordCount.nexp"]] <- list(
# mapfn = function(WordCount) { return(exp(-WordCount)) }
# , args = c("WordCount"))
#print(summary(glbObsAll$WordCount))
#print(summary(mapfn(glbObsAll$WordCount)))
# If imputation shd be skipped for this feature
# glbFeatsDerive[["District.fctr"]] <- list(
# mapfn = function(District) {
# raw <- District;
# ret_vals <- rep_len("NA", length(raw));
# ret_vals[!is.na(raw)] <- sapply(raw[!is.na(raw)], function(elm)
# ifelse(elm < 10, "1-9",
# ifelse(elm < 20, "10-19", "20+")));
# return(relevel(as.factor(ret_vals), ref = "NA"))
# }
# , args = c("District"))
# YOB options:
# 1. Missing data:
# 1.1 0 -> Does not improve baseline
# 1.2 Cut factors & "NA" is a level
# 2. Data corrections: < 1928 & > 2000
# 3. Scale YOB
# 4. Add Age
# YOB.Age.fctr needs to be synced with YOB.Age.dff; Create a separate sub-function ???
glbFeatsDerive[["YOB.Age.fctr"]] <- list(
mapfn = function(raw1) {
raw <- 2016 - raw1
# raw[!is.na(raw) & raw >= 2010] <- NA
raw[!is.na(raw) & (raw <= 15)] <- NA
raw[!is.na(raw) & (raw >= 90)] <- NA
retVal <- rep_len("NA", length(raw))
# breaks = c(1879, seq(1949, 1989, 10), 2049)
# cutVal <- cut(raw[!is.na(raw)], breaks = breaks,
# labels = as.character(breaks + 1)[1:(length(breaks) - 1)])
cutVal <- cut(raw[!is.na(raw)], breaks = c(15, 20, 25, 30, 35, 40, 50, 65, 90))
retVal[!is.na(raw)] <- levels(cutVal)[cutVal]
return(factor(retVal, levels = c("NA"
,"(15,20]","(20,25]","(25,30]","(30,35]","(35,40]","(40,50]","(50,65]","(65,90]"),
ordered = TRUE))
}
, args = c("YOB"))
# YOB.Age.fctr needs to be synced with YOB.Age.dff; Create a separate sub-function ???
glbFeatsDerive[["YOB.Age.dff"]] <- list(
mapfn = function(raw1) {
raw <- 2016 - raw1
raw[!is.na(raw) & (raw <= 15)] <- NA
raw[!is.na(raw) & (raw >= 90)] <- NA
breaks <- c(15, 20, 25, 30, 35, 40, 50, 65, 90)
# retVal <- rep_len(0, length(raw))
stopifnot(sum(!is.na(raw) && (raw <= 15)) == 0)
stopifnot(sum(!is.na(raw) && (raw >= 90)) == 0)
# msk <- !is.na(raw) && (raw > 15) && (raw <= 20); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 15
# msk <- !is.na(raw) && (raw > 20) && (raw <= 25); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 20
# msk <- !is.na(raw) && (raw > 25) && (raw <= 30); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 25
# msk <- !is.na(raw) && (raw > 30) && (raw <= 35); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 30
# msk <- !is.na(raw) && (raw > 35) && (raw <= 40); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 35
# msk <- !is.na(raw) && (raw > 40) && (raw <= 50); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 40
# msk <- !is.na(raw) && (raw > 50) && (raw <= 65); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 50
# msk <- !is.na(raw) && (raw > 65) && (raw <= 90); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 65
breaks <- c(15, 20, 25, 30, 35, 40, 50, 65, 90)
retVal <- sapply(raw, function(age) {
if (is.na(age)) return(0) else
if ((age > 15) && (age <= 20)) return(age - 15) else
if ((age > 20) && (age <= 25)) return(age - 20) else
if ((age > 25) && (age <= 30)) return(age - 25) else
if ((age > 30) && (age <= 35)) return(age - 30) else
if ((age > 35) && (age <= 40)) return(age - 35) else
if ((age > 40) && (age <= 50)) return(age - 40) else
if ((age > 50) && (age <= 65)) return(age - 50) else
if ((age > 65) && (age <= 90)) return(age - 65)
})
return(retVal)
}
, args = c("YOB"))
glbFeatsDerive[["Gender.fctr"]] <- list(
mapfn = function(raw1) {
raw <- raw1
raw[raw %in% ""] <- "N"
raw <- gsub("Male" , "M", raw, fixed = TRUE)
raw <- gsub("Female", "F", raw, fixed = TRUE)
return(relevel(as.factor(raw), ref = "N"))
}
, args = c("Gender"))
glbFeatsDerive[["Income.fctr"]] <- list(
mapfn = function(raw1) { raw <- raw1;
raw[raw %in% ""] <- "N"
raw <- gsub("under $25,000" , "<25K" , raw, fixed = TRUE)
raw <- gsub("$25,001 - $50,000" , "25-50K" , raw, fixed = TRUE)
raw <- gsub("$50,000 - $74,999" , "50-75K" , raw, fixed = TRUE)
raw <- gsub("$75,000 - $100,000" , "75-100K" , raw, fixed = TRUE)
raw <- gsub("$100,001 - $150,000", "100-150K", raw, fixed = TRUE)
raw <- gsub("over $150,000" , ">150K" , raw, fixed = TRUE)
return(factor(raw, levels = c("N","<25K","25-50K","50-75K","75-100K","100-150K",">150K"),
ordered = TRUE))
}
, args = c("Income"))
glbFeatsDerive[["Hhold.fctr"]] <- list(
mapfn = function(raw1) { raw <- raw1;
raw[raw %in% ""] <- "N"
raw <- gsub("Domestic Partners (no kids)", "PKn", raw, fixed = TRUE)
raw <- gsub("Domestic Partners (w/kids)" , "PKy", raw, fixed = TRUE)
raw <- gsub("Married (no kids)" , "MKn", raw, fixed = TRUE)
raw <- gsub("Married (w/kids)" , "MKy", raw, fixed = TRUE)
raw <- gsub("Single (no kids)" , "SKn", raw, fixed = TRUE)
raw <- gsub("Single (w/kids)" , "SKy", raw, fixed = TRUE)
return(relevel(as.factor(raw), ref = "N"))
}
, args = c("HouseholdStatus"))
glbFeatsDerive[["Edn.fctr"]] <- list(
mapfn = function(raw1) { raw <- raw1;
raw[raw %in% ""] <- "N"
raw <- gsub("Current K-12" , "K12", raw, fixed = TRUE)
raw <- gsub("High School Diploma" , "HSD", raw, fixed = TRUE)
raw <- gsub("Current Undergraduate", "CCg", raw, fixed = TRUE)
raw <- gsub("Associate's Degree" , "Ast", raw, fixed = TRUE)
raw <- gsub("Bachelor's Degree" , "Bcr", raw, fixed = TRUE)
raw <- gsub("Master's Degree" , "Msr", raw, fixed = TRUE)
raw <- gsub("Doctoral Degree" , "PhD", raw, fixed = TRUE)
return(factor(raw, levels = c("N","K12","HSD","CCg","Ast","Bcr","Msr","PhD"),
ordered = TRUE))
}
, args = c("EducationLevel"))
# for (qsn in c("Q124742","Q124122"))
# for (qsn in grep("Q12(.{4})(?!\\.fctr)", names(glbObsTrn), value = TRUE, perl = TRUE))
for (qsn in grep("Q", glbFeatsExclude, fixed = TRUE, value = TRUE))
glbFeatsDerive[[paste0(qsn, ".fctr")]] <- list(
mapfn = function(raw1) {
raw1[raw1 %in% ""] <- "NA"
rawVal <- unique(raw1)
if (length(setdiff(rawVal, (expVal <- c("NA", "No", "Ys")))) == 0) {
raw1 <- gsub("Yes", "Ys", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
} else
if (length(setdiff(rawVal, (expVal <- c("NA", "Me", "Circumstances")))) == 0) {
raw1 <- gsub("Circumstances", "Cs", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
} else
if (length(setdiff(rawVal, (expVal <- c("NA", "Grrr people", "Yay people!")))) == 0) {
raw1 <- gsub("Grrr people", "Gr", raw1, fixed = TRUE)
raw1 <- gsub("Yay people!", "Yy", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
} else
if (length(setdiff(rawVal, (expVal <- c("NA", "Idealist", "Pragmatist")))) == 0) {
raw1 <- gsub("Idealist" , "Id", raw1, fixed = TRUE)
raw1 <- gsub("Pragmatist", "Pr", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
} else
if (length(setdiff(rawVal, (expVal <- c("NA", "Private", "Public")))) == 0) {
raw1 <- gsub("Private", "Pt", raw1, fixed = TRUE)
raw1 <- gsub("Public" , "Pc", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
}
return(relevel(as.factor(raw1), ref = "NA"))
}
, args = c(qsn))
# If imputation of missing data is not working ...
# glbFeatsDerive[["FertilityRate.nonNA"]] <- list(
# mapfn = function(FertilityRate, Region) {
# RegionMdn <- tapply(FertilityRate, Region, FUN = median, na.rm = TRUE)
#
# retVal <- FertilityRate
# retVal[is.na(FertilityRate)] <- RegionMdn[Region[is.na(FertilityRate)]]
# return(retVal)
# }
# , args = c("FertilityRate", "Region"))
# mapfn = function(HOSPI.COST) { return(cut(HOSPI.COST, 5, breaks = c(0, 100000, 200000, 300000, 900000), labels = NULL)) }
# mapfn = function(Rasmussen) { return(ifelse(sign(Rasmussen) >= 0, 1, 0)) }
# mapfn = function(startprice) { return(startprice ^ (1/2)) }
# mapfn = function(startprice) { return(log(startprice)) }
# mapfn = function(startprice) { return(exp(-startprice / 20)) }
# mapfn = function(startprice) { return(scale(log(startprice))) }
# mapfn = function(startprice) { return(sign(sprice.predict.diff) * (abs(sprice.predict.diff) ^ (1/10))) }
# factor
# mapfn = function(PropR) { return(as.factor(ifelse(PropR >= 0.5, "Y", "N"))) }
# mapfn = function(productline, description) { as.factor(gsub(" ", "", productline)) }
# mapfn = function(purpose) { return(relevel(as.factor(purpose), ref="all_other")) }
# mapfn = function(raw) { tfr_raw <- as.character(cut(raw, 5));
# tfr_raw[is.na(tfr_raw)] <- "NA.my";
# return(as.factor(tfr_raw)) }
# mapfn = function(startprice.log10) { return(cut(startprice.log10, 3)) }
# mapfn = function(startprice.log10) { return(cut(sprice.predict.diff, c(-1000, -100, -10, -1, 0, 1, 10, 100, 1000))) }
# , args = c("<arg1>"))
# multiple args
# mapfn = function(id, date) { return(paste(as.character(id), as.character(date), sep = "#")) }
# mapfn = function(PTS, oppPTS) { return(PTS - oppPTS) }
# mapfn = function(startprice.log10.predict, startprice) {
# return(spdiff <- (10 ^ startprice.log10.predict) - startprice) }
# mapfn = function(productline, description) { as.factor(
# paste(gsub(" ", "", productline), as.numeric(nchar(description) > 0), sep = "*")) }
# mapfn = function(.src, .pos) {
# return(paste(.src, sprintf("%04d",
# ifelse(.src == "Train", .pos, .pos - 7049)
# ), sep = "#")) }
# # If glbObsAll is not sorted in the desired manner
# mapfn=function(Week) { return(coredata(lag(zoo(orderBy(~Week, glbObsAll)$ILI), -2, na.pad=TRUE))) }
# mapfn=function(ILI) { return(coredata(lag(zoo(ILI), -2, na.pad=TRUE))) }
# mapfn=function(ILI.2.lag) { return(log(ILI.2.lag)) }
# glbFeatsDerive[["<var1>"]] <- glbFeatsDerive[["<var2>"]]
# tst <- "descr.my"; args_lst <- NULL; for (arg in glbFeatsDerive[[tst]]$args) args_lst[[arg]] <- glbObsAll[, arg]; print(head(args_lst[[arg]])); print(head(drv_vals <- do.call(glbFeatsDerive[[tst]]$mapfn, args_lst)));
# print(which_ix <- which(args_lst[[arg]] == 0.75)); print(drv_vals[which_ix]);
glbFeatsDateTime <- list()
# Use OlsonNames() to enumerate supported time zones
# glbFeatsDateTime[["<DateTimeFeat>"]] <-
# c(format = "%Y-%m-%d %H:%M:%S" or "%m/%e/%y", timezone = "US/Eastern", impute.na = TRUE,
# last.ctg = FALSE, poly.ctg = FALSE)
glbFeatsPrice <- NULL # or c("<price_var>")
glbFeatsImage <- list() #list(<imageFeat> = list(patchSize = 10)) # if patchSize not specified, no patch computation
glbFeatsText <- list()
Sys.setlocale("LC_ALL", "C") # For english
## [1] "C/C/C/C/C/en_US.UTF-8"
#glbFeatsText[["<TextFeature>"]] <- list(NULL,
# ,names = myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL,
# <comma-separated-screened-names>
# ))))
# ,rareWords = myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL,
# <comma-separated-nonSCOWL-words>
# ))))
#)
# Text Processing Step: custom modifications not present in txt_munge -> use glbFeatsDerive
# Text Processing Step: universal modifications
glb_txt_munge_filenames_pfx <- "<projectId>_mytxt_"
# Text Processing Step: tolower
# Text Processing Step: myreplacePunctuation
# Text Processing Step: removeWords
glb_txt_stop_words <- list()
# Remember to use unstemmed words
if (length(glbFeatsText) > 0) {
require(tm)
require(stringr)
glb_txt_stop_words[["<txt_var>"]] <- sort(myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
# Remove any words from stopwords
# , setdiff(myreplacePunctuation(stopwords("english")), c("<keep_wrd1>", <keep_wrd2>"))
# Remove salutations
,"mr","mrs","dr","Rev"
# Remove misc
#,"th" # Happy [[:digit::]]+th birthday
# Remove terms present in Trn only or New only; search for "Partition post-stem"
# ,<comma-separated-terms>
# cor.y.train == NA
# ,unlist(strsplit(paste(c(NULL
# ,"<comma-separated-terms>"
# ), collapse=",")
# freq == 1; keep c("<comma-separated-terms-to-keep>")
# ,<comma-separated-terms>
# chisq.pval high (e.g. == 1); keep c("<comma-separated-terms-to-keep>")
# ,<comma-separated-terms>
# nzv.freqRatio high (e.g. >= glbFeatsNzvFreqMax); keep c("<comma-separated-terms-to-keep>")
# ,<comma-separated-terms>
)))))
}
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^man", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
#glbObsAll[glb_post_stem_words_terms_mtrx_lst[[txtFeat]][, 4866] > 0, c(glb_rsp_var, txtFeat)]
# To identify terms with a specific freq
#paste0(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], freq == 1)$term), collapse = ",")
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], freq <= 2)$term), collapse = ",")
#subset(glb_post_stem_words_terms_df_lst[[txtFeat]], term %in% c("zinger"))
# To identify terms with a specific freq &
# are not stemmed together later OR is value of color.fctr (e.g. gold)
#paste0(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], (freq == 1) & !(term %in% c("blacked","blemish","blocked","blocks","buying","cables","careful","carefully","changed","changing","chargers","cleanly","cleared","connect","connects","connected","contains","cosmetics","default","defaulting","defective","definitely","describe","described","devices","displays","drop","drops","engravement","excellant","excellently","feels","fix","flawlessly","frame","framing","gentle","gold","guarantee","guarantees","handled","handling","having","install","iphone","iphones","keeped","keeps","known","lights","line","lining","liquid","liquidation","looking","lots","manuals","manufacture","minis","most","mostly","network","networks","noted","opening","operated","performance","performs","person","personalized","photograph","physically","placed","places","powering","pre","previously","products","protection","purchasing","returned","rotate","rotation","running","sales","second","seconds","shipped","shuts","sides","skin","skinned","sticker","storing","thats","theres","touching","unusable","update","updates","upgrade","weeks","wrapped","verified","verify") ))$term), collapse = ",")
#print(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (freq <= 2)))
#glbObsAll[which(terms_mtrx[, 229] > 0), glbFeatsText]
# To identify terms with cor.y == NA
#orderBy(~-freq+term, subset(glb_post_stop_words_terms_df_lst[[txtFeat]], is.na(cor.y)))
#paste(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], is.na(cor.y))[, "term"]), collapse=",")
#orderBy(~-freq+term, subset(glb_post_stem_words_terms_df_lst[[txtFeat]], is.na(cor.y)))
# To identify terms with low cor.y.abs
#head(orderBy(~cor.y.abs+freq+term, subset(glb_post_stem_words_terms_df_lst[[txtFeat]], !is.na(cor.y))), 5)
# To identify terms with high chisq.pval
#subset(glb_post_stem_words_terms_df_lst[[txtFeat]], chisq.pval > 0.99)
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (chisq.pval > 0.99) & (freq <= 10))$term), collapse=",")
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (chisq.pval > 0.9))$term), collapse=",")
#head(orderBy(~-chisq.pval+freq+term, glb_post_stem_words_terms_df_lst[[txtFeat]]), 5)
#glbObsAll[glb_post_stem_words_terms_mtrx_lst[[txtFeat]][, 68] > 0, glbFeatsText]
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^m", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
# To identify terms with high nzv.freqRatio
#summary(glb_post_stem_words_terms_df_lst[[txtFeat]]$nzv.freqRatio)
#paste0(sort(setdiff(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (nzv.freqRatio >= glbFeatsNzvFreqMax) & (freq < 10) & (chisq.pval >= 0.05))$term, c( "128gb","3g","4g","gold","ipad1","ipad3","ipad4","ipadair2","ipadmini2","manufactur","spacegray","sprint","tmobil","verizon","wifion"))), collapse=",")
# To identify obs with a txt term
#tail(orderBy(~-freq+term, glb_post_stop_words_terms_df_lst[[txtFeat]]), 20)
#mydspObs(list(descr.my.contains="non"), cols=c("color", "carrier", "cellular", "storage"))
#grep("ever", dimnames(terms_stop_mtrx)$Terms)
#which(terms_stop_mtrx[, grep("ipad", dimnames(terms_stop_mtrx)$Terms)] > 0)
#glbObsAll[which(terms_stop_mtrx[, grep("16", dimnames(terms_stop_mtrx)$Terms)[1]] > 0), c(glbFeatsCategory, "storage", txtFeat)]
# Text Processing Step: screen for names # Move to glbFeatsText specs section in order of text processing steps
# glbFeatsText[["<txtFeat>"]]$names <- myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
# # Person names for names screening
# ,<comma-separated-list>
#
# # Company names
# ,<comma-separated-list>
#
# # Product names
# ,<comma-separated-list>
# ))))
# glbFeatsText[["<txtFeat>"]]$rareWords <- myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
# # Words not in SCOWL db
# ,<comma-separated-list>
# ))))
# To identify char vectors post glbFeatsTextMap
#grep("six(.*)hour", glb_txt_chr_lst[[txtFeat]], ignore.case = TRUE, value = TRUE)
#grep("[S|s]ix(.*)[H|h]our", glb_txt_chr_lst[[txtFeat]], value = TRUE)
# To identify whether terms shd be synonyms
#orderBy(~term, glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^moder", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ])
# term_row_df <- glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^came$", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ]
#
# cor(glb_post_stop_words_terms_mtrx_lst[[txtFeat]][glbObsAll$.lcn == "Fit", term_row_df$pos], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
# To identify which stopped words are "close" to a txt term
#sort(glbFeatsCluster)
# Text Processing Step: stemDocument
# To identify stemmed txt terms
#glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^la$", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ]
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^con", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
#glbObsAll[which(terms_stem_mtrx[, grep("use", dimnames(terms_stem_mtrx)$Terms)[[1]]] > 0), c(glbFeatsId, "productline", txtFeat)]
#glbObsAll[which(TfIdf_stem_mtrx[, 191] > 0), c(glbFeatsId, glbFeatsCategory, txtFeat)]
#glbObsAll[which(glb_post_stop_words_terms_mtrx_lst[[txtFeat]][, 6165] > 0), c(glbFeatsId, glbFeatsCategory, txtFeat)]
#which(glbObsAll$UniqueID %in% c(11915, 11926, 12198))
# Text Processing Step: mycombineSynonyms
# To identify which terms are associated with not -> combine "could not" & "couldn't"
#findAssocs(glb_full_DTM_lst[[txtFeat]], "not", 0.05)
# To identify which synonyms should be combined
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^c", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
chk_comb_cor <- function(syn_lst) {
# cor(terms_stem_mtrx[glbObsAll$.src == "Train", grep("^(damag|dent|ding)$", dimnames(terms_stem_mtrx)[[2]])], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
print(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], term %in% syn_lst$syns))
print(subset(get_corpus_terms(tm_map(glbFeatsTextCorpus[[txtFeat]], mycombineSynonyms, list(syn_lst), lazy=FALSE)), term == syn_lst$word))
# cor(terms_stop_mtrx[glbObsAll$.src == "Train", grep("^(damage|dent|ding)$", dimnames(terms_stop_mtrx)[[2]])], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
# cor(rowSums(terms_stop_mtrx[glbObsAll$.src == "Train", grep("^(damage|dent|ding)$", dimnames(terms_stop_mtrx)[[2]])]), glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
}
#chk_comb_cor(syn_lst=list(word="cabl", syns=c("cabl", "cord")))
#chk_comb_cor(syn_lst=list(word="damag", syns=c("damag", "dent", "ding")))
#chk_comb_cor(syn_lst=list(word="dent", syns=c("dent", "ding")))
#chk_comb_cor(syn_lst=list(word="use", syns=c("use", "usag")))
glbFeatsTextSynonyms <- list()
# list parsed to collect glbFeatsText[[<txtFeat>]]$vldTerms
# glbFeatsTextSynonyms[["Hdln.my"]] <- list(NULL
# # people in places
# , list(word = "australia", syns = c("australia", "australian"))
# , list(word = "italy", syns = c("italy", "Italian"))
# , list(word = "newyork", syns = c("newyork", "newyorker"))
# , list(word = "Pakistan", syns = c("Pakistan", "Pakistani"))
# , list(word = "peru", syns = c("peru", "peruvian"))
# , list(word = "qatar", syns = c("qatar", "qatari"))
# , list(word = "scotland", syns = c("scotland", "scotish"))
# , list(word = "Shanghai", syns = c("Shanghai", "Shanzhai"))
# , list(word = "venezuela", syns = c("venezuela", "venezuelan"))
#
# # companies - needs to be data dependent
# # - e.g. ensure BNP in this experiment/feat always refers to BNPParibas
#
# # general synonyms
# , list(word = "Create", syns = c("Create","Creator"))
# , list(word = "cute", syns = c("cute","cutest"))
# , list(word = "Disappear", syns = c("Disappear","Fadeout"))
# , list(word = "teach", syns = c("teach", "taught"))
# , list(word = "theater", syns = c("theater", "theatre", "theatres"))
# , list(word = "understand", syns = c("understand", "understood"))
# , list(word = "weak", syns = c("weak", "weaken", "weaker", "weakest"))
# , list(word = "wealth", syns = c("wealth", "wealthi"))
#
# # custom synonyms (phrases)
#
# # custom synonyms (names)
# )
#glbFeatsTextSynonyms[["<txtFeat>"]] <- list(NULL
# , list(word="<stem1>", syns=c("<stem1>", "<stem1_2>"))
# )
for (txtFeat in names(glbFeatsTextSynonyms))
for (entryIx in 1:length(glbFeatsTextSynonyms[[txtFeat]])) {
glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$word <-
str_to_lower(glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$word)
glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$syns <-
str_to_lower(glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$syns)
}
glbFeatsTextSeed <- 181
# tm options include: check tm::weightSMART
glb_txt_terms_control <- list( # Gather model performance & run-time stats
# weighting = function(x) weightSMART(x, spec = "nnn")
# weighting = function(x) weightSMART(x, spec = "lnn")
# weighting = function(x) weightSMART(x, spec = "ann")
# weighting = function(x) weightSMART(x, spec = "bnn")
# weighting = function(x) weightSMART(x, spec = "Lnn")
#
weighting = function(x) weightSMART(x, spec = "ltn") # default
# weighting = function(x) weightSMART(x, spec = "lpn")
#
# weighting = function(x) weightSMART(x, spec = "ltc")
#
# weighting = weightBin
# weighting = weightTf
# weighting = weightTfIdf # : default
# termFreq selection criteria across obs: tm default: list(global=c(1, Inf))
, bounds = list(global = c(1, Inf))
# wordLengths selection criteria: tm default: c(3, Inf)
, wordLengths = c(1, Inf)
)
glb_txt_cor_var <- glb_rsp_var # : default # or c(<feat>)
# select one from c("union.top.val.cor", "top.cor", "top.val", default: "top.chisq", "sparse")
glbFeatsTextFilter <- "top.chisq"
glbFeatsTextTermsMax <- rep(10, length(glbFeatsText)) # :default
names(glbFeatsTextTermsMax) <- names(glbFeatsText)
# Text Processing Step: extractAssoc
glbFeatsTextAssocCor <- rep(1, length(glbFeatsText)) # :default
names(glbFeatsTextAssocCor) <- names(glbFeatsText)
# Remember to use stemmed terms
glb_important_terms <- list()
# Text Processing Step: extractPatterns (ngrams)
glbFeatsTextPatterns <- list()
#glbFeatsTextPatterns[[<txtFeat>>]] <- list()
#glbFeatsTextPatterns[[<txtFeat>>]] <- c(metropolitan.diary.colon = "Metropolitan Diary:")
# Have to set it even if it is not used
# Properties:
# numrows(glb_feats_df) << numrows(glbObsFit
# Select terms that appear in at least 0.2 * O(FP/FN(glbObsOOB)) ???
# numrows(glbObsOOB) = 1.1 * numrows(glbObsNew) ???
glb_sprs_thresholds <- NULL # or c(<txtFeat1> = 0.988, <txtFeat2> = 0.970, <txtFeat3> = 0.970)
glbFctrMaxUniqVals <- 20 # default: 20
glb_impute_na_data <- FALSE # or TRUE
glb_mice_complete.seed <- 144 # or any integer
glbFeatsCluster <- paste(grep("^Q.", glbFeatsExclude, value = TRUE), "fctr", sep = ".") # NULL : glbFeatsCluster <- c("YOB.Age.fctr", "Gender.fctr", "Income.fctr",
# # "Hhold.fctr",
# "Edn.fctr",
# paste(grep("^Q.", glbFeatsExclude, value = TRUE), "fctr", sep = ".")) # NULL : default or c("<feat1>", "<feat2>")
# glbFeatsCluster <- grep(paste0("[",
# toupper(paste0(substr(glbFeatsText, 1, 1), collapse = "")),
# "]\\.[PT]\\."),
# names(glbObsAll), value = TRUE)
glb_cluster.seed <- 189 # or any integer
glbClusterEntropyVar <- NULL # c(glb_rsp_var, as.factor(cut(glb_rsp_var, 3)), default: NULL)
glbFeatsClusterVarsExclude <- FALSE # default FALSE
glb_interaction_only_feats <- NULL # : default or c(<parent_feat> = "<child_feat>")
glbFeatsNzvFreqMax <- 19 # 19 : caret default
glbFeatsNzvUniqMin <- 10 # 10 : caret default
glbRFESizes <- list()
#glbRFESizes[["mdlFamily"]] <- c(4, 8, 16, 32, 64, 67, 68, 69) # Accuracy@69/70 = 0.8258
# glbRFESizes[["RFE.X"]] <- c(96, 112, 120, 124, 128, 129, 130, 131, 132, 133, 135, 138, 142, 157, 187, 247) # accuracy(131) = 0.6285
# glbRFESizes[["Final"]] <- c(8, 16, 32, 40, 44, 46, 48, 49, 50, 51, 52, 56, 64, 96, 128, 247) # accuracy(49) = 0.6164
glbRFEResults <- NULL
glbObsFitOutliers <- list()
# If outliers.n >= 10; consider concatenation of interaction vars
# glbObsFitOutliers[["<mdlFamily>"]] <- c(NULL
# is.na(.rstudent)
# max(.rstudent)
# is.na(.dffits)
# .hatvalues >= 0.99
# -38,167,642 < minmax(.rstudent) < 49,649,823
# , <comma-separated-<glbFeatsId>>
# )
glbObsTrnOutliers <- list()
glbObsTrnOutliers[["Final"]] <- union(glbObsFitOutliers[["All.X"]],
c(NULL
))
# Modify mdlId to (build & extract) "<FamilyId>#<Fit|Trn>#<caretMethod>#<preProc1.preProc2>#<samplingMethod>"
glb_models_lst <- list(); glb_models_df <- data.frame()
# Add xgboost algorithm
# Regression
if (glb_is_regression) {
glbMdlMethods <- c(NULL
# deterministic
#, "lm", # same as glm
, "glm", "bayesglm", "glmnet"
, "rpart"
# non-deterministic
, "gbm", "rf"
# Unknown
, "nnet" , "avNNet" # runs 25 models per cv sample for tunelength=5
, "svmLinear", "svmLinear2"
, "svmPoly" # runs 75 models per cv sample for tunelength=5
, "svmRadial"
, "earth"
, "bagEarth" # Takes a long time
,"xgbLinear","xgbTree"
)
} else
# Classification - Add ada (auto feature selection)
if (glb_is_binomial)
glbMdlMethods <- c(NULL
# deterministic
, "bagEarth" # Takes a long time
, "glm", "bayesglm", "glmnet"
, "nnet"
, "rpart"
# non-deterministic
, "gbm"
, "avNNet" # runs 25 models per cv sample for tunelength=5
, "rf"
# Unknown
, "lda", "lda2"
# svm models crash when predict is called -> internal to kernlab it should call predict without .outcome
, "svmLinear", "svmLinear2"
, "svmPoly" # runs 75 models per cv sample for tunelength=5
, "svmRadial"
, "earth"
,"xgbLinear","xgbTree"
) else
glbMdlMethods <- c(NULL
# deterministic
,"glmnet"
# non-deterministic
,"rf"
# Unknown
,"gbm","rpart","xgbLinear","xgbTree"
)
glbMdlFamilies <- list(); glb_mdl_feats_lst <- list()
# family: Choose from c("RFE.X", "Csm.X", "All.X", "Best.Interact") %*% c(NUll, ".NOr", ".Inc")
# RFE = "Recursive Feature Elimination"
# Csm = CuStoM
# NOr = No OutlieRs
# Inc = INteraCt
# methods: Choose from c(NULL, <method>, glbMdlMethods)
#glbMdlFamilies[["RFE.X"]] <- c("glmnet", "glm") # non-NULL vector is mandatory
if (glb_is_classification && !glb_is_binomial) {
# glm does not work for multinomial
glbMdlFamilies[["All.X"]] <- c("glmnet")
} else {
glbMdlFamilies[["All.X"]] <- c("glmnet", "glm")
# glbMdlFamilies[["RFE.X"]] <- c("glmnet", "glm")
# glbMdlFamilies[["RFE.X"]] <- setdiff(glbMdlMethods, c(NULL
# , "bayesglm" # error: Error in trControl$classProbs && any(classLevels != make.names(classLevels)) : invalid 'x' type in 'x && y'
# , "lda","lda2" # error: Error in lda.default(x, grouping, ...) : variable 236 appears to be constant within groups
# , "svmLinear" # Error in .local(object, ...) : test vector does not match model ! In addition: Warning messages:
# , "svmLinear2" # SVM has not been trained using `probability = TRUE`, probabilities not available for predictions
# , "svmPoly" # runs 75 models per cv sample for tunelength=5 # took > 2 hrs # Error in .local(object, ...) : test vector does not match model !
# , "svmRadial" # didn't bother
# ,"xgbLinear","xgbTree" # Need clang-omp compiler; Upgrade to Revolution R 3.2.3 (3.2.2 current); https://github.com/dmlc/xgboost/issues/276 thread
# ))
}
# glbMdlFamilies[["All.X.Inc"]] <- glbMdlFamilies[["All.X"]] # value not used
# glbMdlFamilies[["RFE.X.Inc"]] <- glbMdlFamilies[["RFE.X"]] # value not used
# Check if interaction features make RFE better
# glbMdlFamilies[["CSM.X"]] <- setdiff(glbMdlMethods, c("lda", "lda2")) # crashing due to category:.clusterid ??? #c("glmnet", "glm") # non-NULL list is mandatory
# glb_mdl_feats_lst[["CSM.X"]] <- c(NULL
# , <comma-separated-features-vector>
# )
# dAFeats.CSM.X %<d-% c(NULL
# # Interaction feats up to varImp(RFE.X.glmnet) >= 50
# , <comma-separated-features-vector>
# , setdiff(myextract_actual_feats(predictors(glbRFEResults)), c(NULL
# , <comma-separated-features-vector>
# ))
# )
# glb_mdl_feats_lst[["CSM.X"]] <- "%<d-% dAFeats.CSM.X"
# glbMdlFamilies[["Final"]] <- c(NULL) # NULL vector acceptable # c("glmnet", "glm")
glbMdlAllowParallel <- list()
#glbMdlAllowParallel[["Final##rcv#glmnet"]] <- FALSE
glbMdlAllowParallel[["All.X##rcv#glm"]] <- FALSE
# Check if tuning parameters make fit better; make it mdlFamily customizable ?
glbMdlTuneParams <- data.frame()
# When glmnet crashes at model$grid with error: ???
# glmnetTuneParams <- rbind(data.frame()
# ,data.frame(parameter = "alpha", vals = "0.100 0.325 0.550 0.775 1.000")
# ,data.frame(parameter = "lambda", vals = "9.342e-02")
# )
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams,
# cbind(data.frame(mdlId = "<mdlId>"),
# glmnetTuneParams))
#avNNet
# size=[1] 3 5 7 9; decay=[0] 1e-04 0.001 0.01 0.1; bag=[FALSE]; RMSE=1.3300906
#bagEarth
# degree=1 [2] 3; nprune=64 128 256 512 [1024]; RMSE=0.6486663 (up)
bagEarthTuneParams <- rbind(data.frame()
,data.frame(parameter = "degree", vals = "1")
,data.frame(parameter = "nprune", vals = "256")
)
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams,
# cbind(data.frame(mdlId = "Final.RFE.X.Inc##rcv#bagEarth"),
# bagEarthTuneParams))
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "bagEarth", parameter = "nprune", vals = "256")
# ,data.frame(method = "bagEarth", parameter = "degree", vals = "2")
# ))
#earth
# degree=[1]; nprune=2 [9] 17 25 33; RMSE=0.1334478
#gbm
# shrinkage=0.05 [0.10] 0.15 0.20 0.25; n.trees=100 150 200 [250] 300; interaction.depth=[1] 2 3 4 5; n.minobsinnode=[10]; RMSE=0.2008313
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "gbm", parameter = "shrinkage", min = 0.05, max = 0.25, by = 0.05)
# ,data.frame(method = "gbm", parameter = "n.trees", min = 100, max = 300, by = 50)
# ,data.frame(method = "gbm", parameter = "interaction.depth", min = 1, max = 5, by = 1)
# ,data.frame(method = "gbm", parameter = "n.minobsinnode", min = 10, max = 10, by = 10)
# #seq(from=0.05, to=0.25, by=0.05)
# ))
#glmnet
# alpha=0.100 [0.325] 0.550 0.775 1.000; lambda=0.0005232693 0.0024288010 0.0112734954 [0.0523269304] 0.2428800957; RMSE=0.6164891
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "glmnet", parameter = "alpha", vals = "0.550 0.775 0.8875 0.94375 1.000")
# ,data.frame(method = "glmnet", parameter = "lambda", vals = "9.858855e-05 0.0001971771 0.0009152152 0.0042480525 0.0197177130")
# ))
#nnet
# size=3 5 [7] 9 11; decay=0.0001 0.001 0.01 [0.1] 0.2; RMSE=0.9287422
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "nnet", parameter = "size", vals = "3 5 7 9 11")
# ,data.frame(method = "nnet", parameter = "decay", vals = "0.0001 0.0010 0.0100 0.1000 0.2000")
# ))
#rf # Don't bother; results are not deterministic
# mtry=2 35 68 [101] 134; RMSE=0.1339974
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "rf", parameter = "mtry", vals = "2 5 9 13 17")
# ))
#rpart
# cp=0.020 [0.025] 0.030 0.035 0.040; RMSE=0.1770237
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "rpart", parameter = "cp", vals = "0.004347826 0.008695652 0.017391304 0.021739130 0.034782609")
# ))
#svmLinear
# C=0.01 0.05 [0.10] 0.50 1.00 2.00 3.00 4.00; RMSE=0.1271318; 0.1296718
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "svmLinear", parameter = "C", vals = "0.01 0.05 0.1 0.5 1")
# ))
#svmLinear2
# cost=0.0625 0.1250 [0.25] 0.50 1.00; RMSE=0.1276354
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "svmLinear2", parameter = "cost", vals = "0.0625 0.125 0.25 0.5 1")
# ))
#svmPoly
# degree=[1] 2 3 4 5; scale=0.01 0.05 [0.1] 0.5 1; C=0.50 1.00 [2.00] 3.00 4.00; RMSE=0.1276130
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method="svmPoly", parameter="degree", min=1, max=5, by=1) #seq(1, 5, 1)
# ,data.frame(method="svmPoly", parameter="scale", vals="0.01, 0.05, 0.1, 0.5, 1")
# ,data.frame(method="svmPoly", parameter="C", vals="0.50, 1.00, 2.00, 3.00, 4.00")
# ))
#svmRadial
# sigma=[0.08674323]; C=0.25 0.50 1.00 [2.00] 4.00; RMSE=0.1614957
#glb2Sav(); all.equal(sav_models_df, glb_models_df)
pkgPreprocMethods <-
# caret version: 6.0.068 # packageVersion("caret")
# operations are applied in this order: zero-variance filter, near-zero variance filter, Box-Cox/Yeo-Johnson/exponential transformation, centering, scaling, range, imputation, PCA, ICA then spatial sign
# *Impute methods needed only if NAs are fed to myfit_mdl
# Also, ordered.factor in caret creates features as Edn.fctr^4 which is treated as an exponent by bagImpute
c(NULL
,"zv", "nzv"
,"BoxCox", "YeoJohnson", "expoTrans"
,"center", "scale", "center.scale", "range"
,"knnImpute", "bagImpute", "medianImpute"
,"zv.pca", "ica", "spatialSign"
,"conditionalX")
glbMdlPreprocMethods <- list(NULL # : default
# "All.X" = list("glmnet" = union(setdiff(pkgPreprocMethods,
# c("knnImpute", "bagImpute", "medianImpute")),
# # NULL))
# c("nzv.spatialSign")))
)
# glbMdlPreprocMethods[["RFE.X"]] <- list("glmnet" = union(unlist(glbMdlPreprocMethods[["All.X"]]),
# "nzv.pca.spatialSign"))
# Baseline prediction model feature(s)
glb_Baseline_mdl_var <- NULL # or c("<feat>")
glbMdlMetric_terms <- NULL # or matrix(c(
# 0,1,2,3,4,
# 2,0,1,2,3,
# 4,2,0,1,2,
# 6,4,2,0,1,
# 8,6,4,2,0
# ), byrow=TRUE, nrow=5)
glbMdlMetricSummary <- NULL # or "<metric_name>"
glbMdlMetricMaximize <- NULL # or FALSE (TRUE is not the default for both classification & regression)
glbMdlMetricSummaryFn <- NULL # or function(data, lev=NULL, model=NULL) {
# confusion_mtrx <- t(as.matrix(confusionMatrix(data$pred, data$obs)))
# #print(confusion_mtrx)
# #print(confusion_mtrx * glbMdlMetric_terms)
# metric <- sum(confusion_mtrx * glbMdlMetric_terms) / nrow(data)
# names(metric) <- glbMdlMetricSummary
# return(metric)
# }
glbMdlCheckRcv <- FALSE # Turn it on when needed; otherwise takes long time
glb_rcv_n_folds <- 3 # or NULL
glb_rcv_n_repeats <- 3 # or NULL
glb_clf_proba_threshold <- NULL # 0.5
# Model selection criteria
if (glb_is_regression)
glbMdlMetricsEval <- c("min.RMSE.OOB", "max.R.sq.OOB", "min.elapsedtime.everything",
"max.Adj.R.sq.fit", "min.RMSE.fit")
#glbMdlMetricsEval <- c("min.RMSE.fit", "max.R.sq.fit", "max.Adj.R.sq.fit")
if (glb_is_classification) {
if (glb_is_binomial)
glbMdlMetricsEval <-
c("max.Accuracy.OOB", "max.AUCROCR.OOB", "max.AUCpROC.OOB",
"min.elapsedtime.everything",
# "min.aic.fit",
"max.Accuracy.fit") else
glbMdlMetricsEval <- c("max.Accuracy.OOB", "max.Kappa.OOB", "min.elapsedtime.everything")
}
# select from NULL [no ensemble models], "auto" [all models better than MFO or Baseline], c(mdl_ids in glb_models_lst) [Typically top-rated models in auto]
glbMdlEnsemble <- NULL #"auto"
# "%<d-% setdiff(mygetEnsembleAutoMdlIds(), 'CSM.X.rf')"
# c(<comma-separated-mdlIds>
# )
# Only for classifications; for regressions remove "(.*)\\.prob" form the regex
# tmp_fitobs_df <- glbObsFit[, grep(paste0("^", gsub(".", "\\.", mygetPredictIds$value, fixed = TRUE), "CSM\\.X\\.(.*)\\.prob"), names(glbObsFit), value = TRUE)]; cor_mtrx <- cor(tmp_fitobs_df); cor_vctr <- sort(cor_mtrx[row.names(orderBy(~-Overall, varImp(glb_models_lst[["Ensemble.repeatedcv.glmnet"]])$imp))[1], ]); summary(cor_vctr); cor_vctr
#ntv.glm <- glm(reformulate(indepVar, glb_rsp_var), family = "binomial", data = glbObsFit)
#step.glm <- step(ntv.glm)
glbMdlSelId <- "All.X##rcv#glmnet" #select from c(NULL, "All.X##rcv#glmnet", "RFE.X##rcv#glmnet", <mdlId>)
glbMdlFinId <- NULL #select from c(NULL, glbMdlSelId)
glb_dsp_cols <- c(".pos", glbFeatsId, glbFeatsCategory, glb_rsp_var
# List critical cols excl. above
)
# Output specs
# lclgetfltout_df <- function(obsOutFinDf) {
# require(tidyr)
# obsOutFinDf <- obsOutFinDf %>%
# tidyr::separate("ImageId.x.y", c(".src", ".pos", "x", "y"),
# sep = "#", remove = TRUE, extra = "merge")
# # mnm prefix stands for max_n_mean
# mnmout_df <- obsOutFinDf %>%
# dplyr::group_by(.pos) %>%
# #dplyr::top_n(1, Probability1) %>% # Score = 3.9426
# #dplyr::top_n(2, Probability1) %>% # Score = ???; weighted = 3.94254;
# #dplyr::top_n(3, Probability1) %>% # Score = 3.9418; weighted = 3.94169;
# dplyr::top_n(4, Probability1) %>% # Score = ???; weighted = 3.94149;
# #dplyr::top_n(5, Probability1) %>% # Score = 3.9421; weighted = 3.94178
#
# # dplyr::summarize(xMeanN = mean(as.numeric(x)), yMeanN = mean(as.numeric(y)))
# # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), Probability1), yMeanN = mean(as.numeric(y)))
# # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1, 0.2357323, 0.2336925)), yMeanN = mean(as.numeric(y)))
# # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1)), yMeanN = mean(as.numeric(y)))
# dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1)),
# yMeanN = weighted.mean(as.numeric(y), c(Probability1)))
#
# maxout_df <- obsOutFinDf %>%
# dplyr::group_by(.pos) %>%
# dplyr::summarize(maxProb1 = max(Probability1))
# fltout_df <- merge(maxout_df, obsOutFinDf,
# by.x = c(".pos", "maxProb1"), by.y = c(".pos", "Probability1"),
# all.x = TRUE)
# fmnout_df <- merge(fltout_df, mnmout_df,
# by.x = c(".pos"), by.y = c(".pos"),
# all.x = TRUE)
# return(fmnout_df)
# }
glbObsOut <- list(NULL
# glbFeatsId will be the first output column, by default
,vars = list()
# ,mapFn = function(obsOutFinDf) {
# }
)
#obsOutFinDf <- savobsOutFinDf
# glbObsOut$mapFn <- function(obsOutFinDf) {
# txfout_df <- dplyr::select(obsOutFinDf, -.pos.y) %>%
# dplyr::mutate(
# lunch = levels(glbObsTrn[, "lunch" ])[
# round(mean(as.numeric(glbObsTrn[, "lunch" ])), 0)],
# dinner = levels(glbObsTrn[, "dinner" ])[
# round(mean(as.numeric(glbObsTrn[, "dinner" ])), 0)],
# reserve = levels(glbObsTrn[, "reserve" ])[
# round(mean(as.numeric(glbObsTrn[, "reserve" ])), 0)],
# outdoor = levels(glbObsTrn[, "outdoor" ])[
# round(mean(as.numeric(glbObsTrn[, "outdoor" ])), 0)],
# expensive = levels(glbObsTrn[, "expensive"])[
# round(mean(as.numeric(glbObsTrn[, "expensive"])), 0)],
# liquor = levels(glbObsTrn[, "liquor" ])[
# round(mean(as.numeric(glbObsTrn[, "liquor" ])), 0)],
# table = levels(glbObsTrn[, "table" ])[
# round(mean(as.numeric(glbObsTrn[, "table" ])), 0)],
# classy = levels(glbObsTrn[, "classy" ])[
# round(mean(as.numeric(glbObsTrn[, "classy" ])), 0)],
# kids = levels(glbObsTrn[, "kids" ])[
# round(mean(as.numeric(glbObsTrn[, "kids" ])), 0)]
# )
#
# print("ObsNew output class tables:")
# print(sapply(c("lunch","dinner","reserve","outdoor",
# "expensive","liquor","table",
# "classy","kids"),
# function(feat) table(txfout_df[, feat], useNA = "ifany")))
#
# txfout_df <- txfout_df %>%
# dplyr::mutate(labels = "") %>%
# dplyr::mutate(labels =
# ifelse(lunch != "-1", paste(labels, lunch ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(dinner != "-1", paste(labels, dinner ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(reserve != "-1", paste(labels, reserve ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(outdoor != "-1", paste(labels, outdoor ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(expensive != "-1", paste(labels, expensive), labels)) %>%
# dplyr::mutate(labels =
# ifelse(liquor != "-1", paste(labels, liquor ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(table != "-1", paste(labels, table ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(classy != "-1", paste(labels, classy ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(kids != "-1", paste(labels, kids ), labels)) %>%
# dplyr::select(business_id, labels)
# return(txfout_df)
# }
#if (!is.null(glbObsOut$mapFn)) obsOutFinDf <- glbObsOut$mapFn(obsOutFinDf); print(head(obsOutFinDf))
glb_out_obs <- NULL # select from c(NULL : default to "new", "all", "new", "trn")
if (glb_is_classification && glb_is_binomial) {
# glbObsOut$vars[["Probability1"]] <-
# "%<d-% glbObsNew[, mygetPredictIds(glb_rsp_var, glbMdlFinId)$prob]"
# glbObsOut$vars[[glb_rsp_var_raw]] <-
# "%<d-% glb_map_rsp_var_to_raw(glbObsNew[,
# mygetPredictIds(glb_rsp_var, glbMdlFinId)$value])"
glbObsOut$vars[["Predictions"]] <-
"%<d-% glb_map_rsp_var_to_raw(glbObsNew[,
mygetPredictIds(glb_rsp_var, glbMdlFinId)$value])"
} else {
# glbObsOut$vars[[glbFeatsId]] <-
# "%<d-% as.integer(gsub('Test#', '', glbObsNew[, glbFeatsId]))"
glbObsOut$vars[[glb_rsp_var]] <-
"%<d-% glbObsNew[, mygetPredictIds(glb_rsp_var, glbMdlFinId)$value]"
# for (outVar in setdiff(glbFeatsExcludeLcl, glb_rsp_var_raw))
# glbObsOut$vars[[outVar]] <-
# paste0("%<d-% mean(glbObsAll[, \"", outVar, "\"], na.rm = TRUE)")
}
# glbObsOut$vars[[glb_rsp_var_raw]] <- glb_rsp_var_raw
# glbObsOut$vars[[paste0(head(unlist(strsplit(mygetPredictIds$value, "")), -1), collapse = "")]] <-
glbOutStackFnames <- # NULL #: default
c("Votes_Ensemble_cnk06_out_fin.csv") # manual stack
# c("ebayipads_finmdl_bid1_out_nnet_1.csv") # universal stack
glbOut <- list(pfx = "Q109244No_AllX_")
# lclImageSampleSeed <- 129
glbOutDataVizFname <- NULL # choose from c(NULL, "<projectId>_obsall.csv")
glbChunks <- list(labels = c("set_global_options_wd","set_global_options"
,"import.data","inspect.data","scrub.data","transform.data"
,"extract.features"
,"extract.features.datetime","extract.features.image","extract.features.price"
,"extract.features.text","extract.features.string"
,"extract.features.end"
,"manage.missing.data","cluster.data","partition.data.training","select.features"
,"fit.models_0","fit.models_1","fit.models_2","fit.models_3"
,"fit.data.training_0","fit.data.training_1"
,"predict.data.new"
,"display.session.info"))
# To ensure that all chunks in this script are in glbChunks
if (!is.null(chkChunksLabels <- knitr::all_labels()) && # knitr::all_labels() doesn't work in console runs
!identical(chkChunksLabels, glbChunks$labels)) {
print(sprintf("setdiff(chkChunksLabels, glbChunks$labels): %s",
setdiff(chkChunksLabels, glbChunks$labels)))
print(sprintf("setdiff(glbChunks$labels, chkChunksLabels): %s",
setdiff(glbChunks$labels, chkChunksLabels)))
}
glbChunks[["first"]] <- NULL # NULL # default: script will load envir from previous chunk
glbChunks[["last" ]] <- NULL # NULL # default: script will save envir at end of this chunk
glbChunks[["inpFilePathName"]] <- NULL # NULL: default or "data/<prvScriptName>_<lstChunkLbl>.RData"
#mysavChunk(glbOut$pfx, glbChunks[["last"]]) # called from myevlChunk
# Temporary: Delete this function (if any) from here after appropriate .RData file is saved
# Inspect max OOB FP
#chkObsOOB <- subset(glbObsOOB, !label.fctr.All.X..rcv.glmnet.is.acc)
#chkObsOOBFP <- subset(chkObsOOB, label.fctr.All.X..rcv.glmnet == "left_eye_center") %>% dplyr::mutate(Probability1 = label.fctr.All.X..rcv.glmnet.prob) %>% select(-.src, -.pos, -x, -y) %>% lclgetfltout_df() %>% mutate(obj.distance = (((as.numeric(x) - left_eye_center_x.int) ^ 2) + ((as.numeric(y) - left_eye_center_y.int) ^ 2)) ^ 0.5) %>% dplyr::top_n(5, obj.distance) %>% dplyr::top_n(5, -patch.cor)
#
#newImgObs <- glbObsNew[(glbObsNew$ImageId == "Test#0001"), ]; print(newImgObs[which.max(newImgObs$label.fctr.Final..rcv.glmnet.prob), ])
#OOBImgObs <- glbObsOOB[(glbObsOOB$ImageId == "Train#0003"), ]; print(OOBImgObs[which.max(OOBImgObs$label.fctr.All.X..rcv.glmnet.prob), ])
#mygetImage(which(glbObsAll[, glbFeatsId] == "Train#0003"), names(glbFeatsImage)[1], plot = TRUE, featHighlight = c("left_eye_center_x", "left_eye_center_y"), ovrlHighlight = c(66, 35))
# Depict process
glb_analytics_pn <- petrinet(name = "glb_analytics_pn",
trans_df = data.frame(id = 1:6,
name = c("data.training.all","data.new",
"model.selected","model.final",
"data.training.all.prediction","data.new.prediction"),
x=c( -5,-5,-15,-25,-25,-35),
y=c( -5, 5, 0, 0, -5, 5)
),
places_df=data.frame(id=1:4,
name=c("bgn","fit.data.training.all","predict.data.new","end"),
x=c( -0, -20, -30, -40),
y=c( 0, 0, 0, 0),
M0=c( 3, 0, 0, 0)
),
arcs_df = data.frame(
begin = c("bgn","bgn","bgn",
"data.training.all","model.selected","fit.data.training.all",
"fit.data.training.all","model.final",
"data.new","predict.data.new",
"data.training.all.prediction","data.new.prediction"),
end = c("data.training.all","data.new","model.selected",
"fit.data.training.all","fit.data.training.all","model.final",
"data.training.all.prediction","predict.data.new",
"predict.data.new","data.new.prediction",
"end","end")
))
#print(ggplot.petrinet(glb_analytics_pn))
print(ggplot.petrinet(glb_analytics_pn) + coord_flip())
## Loading required package: grid
glb_analytics_avl_objs <- NULL
glb_chunks_df <- myadd_chunk(NULL,
ifelse(is.null(glbChunks$first), "import.data", glbChunks$first))
## label step_major step_minor label_minor bgn end elapsed
## 1 import.data 1 0 0 6.566 NA NA
1.0: import data## [1] "Reading file ./data/train2016.csv..."
## [1] "dimensions of data in ./data/train2016.csv: 5,568 rows x 108 cols"
## USER_ID YOB Gender Income HouseholdStatus
## 1 1 1938 Male Married (w/kids)
## 2 4 1970 Female over $150,000 Domestic Partners (w/kids)
## 3 5 1997 Male $75,000 - $100,000 Single (no kids)
## 4 8 1983 Male $100,001 - $150,000 Married (w/kids)
## 5 9 1984 Female $50,000 - $74,999 Married (w/kids)
## 6 10 1997 Female over $150,000 Single (no kids)
## EducationLevel Party Q124742 Q124122 Q123464 Q123621 Q122769
## 1 Democrat No No No No
## 2 Bachelor's Degree Democrat Yes No No No
## 3 High School Diploma Republican Yes Yes No
## 4 Bachelor's Degree Democrat No Yes No Yes No
## 5 High School Diploma Republican No Yes No No No
## 6 Current K-12 Democrat No
## Q122770 Q122771 Q122120 Q121699 Q121700 Q120978 Q121011 Q120379 Q120650
## 1 Yes Public No Yes No No No Yes
## 2 Yes Public No Yes No Yes No No Yes
## 3 Yes Private No No No Yes No No Yes
## 4 No Public No Yes No Yes No No Yes
## 5 Yes Public No Yes No Yes Yes No Yes
## 6 Yes Public No No No Yes No Yes Yes
## Q120472 Q120194 Q120012 Q120014 Q119334 Q119851 Q119650 Q118892
## 1 Try first No No Yes Yes
## 2 Science Study first Yes Yes No No Receiving No
## 3 Science Study first Yes No Yes Receiving No
## 4 Science Try first No Yes Yes No Giving Yes
## 5 Art Try first Yes No No No Giving No
## 6 Science Try first Yes Yes No Yes Receiving No
## Q118117 Q118232 Q118233 Q118237 Q117186 Q117193 Q116797
## 1 Yes Idealist No No Yes
## 2 No Pragmatist No No Cool headed Standard hours No
## 3 Yes Pragmatist No Yes Cool headed Odd hours No
## 4 No Idealist No No Cool headed Standard hours No
## 5 No Idealist Yes Yes Hot headed Standard hours No
## 6 No Pragmatist No No Standard hours
## Q116881 Q116953 Q116601 Q116441 Q116448 Q116197 Q115602 Q115777 Q115610
## 1 Happy Yes Yes No No P.M. Yes Start Yes
## 2 Happy Yes Yes Yes No A.M. No End Yes
## 3 Right Yes No No Yes A.M. Yes Start Yes
## 4 Happy Yes Yes No No A.M. Yes Start Yes
## 5 Happy Yes Yes No Yes P.M. No End No
## 6
## Q115611 Q115899 Q115390 Q114961 Q114748 Q115195 Q114517 Q114386
## 1 No Circumstances Yes Yes Yes Yes No
## 2 No Me Yes Yes No Yes No Mysterious
## 3 Yes Circumstances No Yes No Yes Yes Mysterious
## 4 No Circumstances Yes No No Yes No TMI
## 5 No Me No Yes Yes Yes Yes TMI
## 6
## Q113992 Q114152 Q113583 Q113584 Q113181 Q112478 Q112512 Q112270
## 1 Yes Yes Talk Technology No No Yes
## 2 No No
## 3 No No Tunes Technology Yes Yes Yes Yes
## 4 No No Talk People No Yes Yes Yes
## 5 Yes No Tunes People No No Yes No
## 6
## Q111848 Q111580 Q111220 Q110740 Q109367 Q108950 Q109244 Q108855
## 1 No Demanding No No Cautious No Yes!
## 2 Mac Yes Cautious No Umm...
## 3 No Supportive No PC No Cautious No Umm...
## 4 Yes Supportive No Mac Yes Risk-friendly No Umm...
## 5 No Demanding Yes PC Yes Cautious No Yes!
## 6 Yes Supportive No PC
## Q108617 Q108856 Q108754 Q108342 Q108343 Q107869 Q107491 Q106993
## 1 No Space No In-person Yes No Yes
## 2 No Space Yes In-person No Yes Yes No
## 3 No Space No In-person No No Yes Yes
## 4 No Socialize Yes Online No Yes No Yes
## 5 No Socialize No Online No No Yes Yes
## 6 In-person No No Yes Yes
## Q106997 Q106272 Q106388 Q106389 Q106042 Q105840 Q105655 Q104996
## 1 Yay people! Yes No Yes Yes No Yes
## 2 Yay people! Yes Yes Yes Yes Yes No Yes
## 3 Grrr people Yes No No No No No No
## 4 Grrr people No No Yes Yes No Yes Yes
## 5 Yay people! Yes No Yes Yes Yes Yes No
## 6 Grrr people Yes No Yes Yes No No Yes
## Q103293 Q102906 Q102674 Q102687 Q102289 Q102089 Q101162 Q101163
## 1 No No No Yes No Own Optimist
## 2
## 3 Yes No No Yes No Own Pessimist Mom
## 4 No No No Yes Yes Own Optimist Mom
## 5 No No Yes No No Own Optimist Mom
## 6 Yes Yes No Yes
## Q101596 Q100689 Q100680 Q100562 Q99982 Q100010 Q99716 Q99581 Q99480
## 1 Yes Yes No No Nope Yes No No
## 2 No
## 3 No No No No Nope Yes No No No
## 4 No No No Yes Check! No No No Yes
## 5 No Yes Yes Yes Nope Yes No No Yes
## 6
## Q98869 Q98578 Q98059 Q98078 Q98197 Q96024
## 1 No Only-child No No Yes
## 2 No No Only-child Yes No No
## 3 Yes No Yes No Yes No
## 4 Yes No Yes No No Yes
## 5 No No Yes No No Yes
## 6
## USER_ID YOB Gender Income HouseholdStatus
## 193 245 1964 Male over $150,000 Married (w/kids)
## 848 1046 1953 Male $100,001 - $150,000 Domestic Partners (no kids)
## 2836 3530 1995 Male Single (no kids)
## 4052 5050 1945 Female $75,000 - $100,000 Married (w/kids)
## 4093 5107 1980 Female $100,001 - $150,000 Married (w/kids)
## 5509 6888 1998 Female under $25,000 Single (no kids)
## EducationLevel Party Q124742 Q124122 Q123464 Q123621
## 193 Bachelor's Degree Republican Yes Yes No Yes
## 848 Democrat
## 2836 Current Undergraduate Democrat Yes Yes Yes No
## 4052 Bachelor's Degree Republican
## 4093 Bachelor's Degree Democrat No No
## 5509 Current K-12 Republican
## Q122769 Q122770 Q122771 Q122120 Q121699 Q121700 Q120978 Q121011
## 193 No Yes Public No Yes No Yes No
## 848
## 2836 Yes Public Yes No No Yes Yes
## 4052 No Public
## 4093 No No Private No
## 5509 Yes Yes
## Q120379 Q120650 Q120472 Q120194 Q120012 Q120014 Q119334 Q119851
## 193 No Yes Science Try first Yes Yes Yes No
## 848
## 2836 Yes Yes Art Study first No Yes Yes
## 4052
## 4093 Yes
## 5509 Yes No Art Study first Yes No Yes No
## Q119650 Q118892 Q118117 Q118232 Q118233 Q118237 Q117186
## 193 Giving Yes No Idealist Yes Yes Hot headed
## 848
## 2836 Yes Yes Idealist Yes No Cool headed
## 4052 No No No
## 4093 No No Pragmatist No Yes
## 5509 Giving No
## Q117193 Q116797 Q116881 Q116953 Q116601 Q116441 Q116448
## 193 Standard hours No Happy Yes Yes No No
## 848
## 2836 Odd hours No Happy Yes Yes No
## 4052
## 4093
## 5509
## Q116197 Q115602 Q115777 Q115610 Q115611 Q115899 Q115390 Q114961
## 193 A.M. Yes End Yes Yes Me No No
## 848
## 2836 Yes End Yes No Circumstances Yes No
## 4052 P.M. Yes Start Yes No No
## 4093 P.M. Yes Start Yes No Circumstances
## 5509
## Q114748 Q115195 Q114517 Q114386 Q113992 Q114152 Q113583 Q113584
## 193 Yes No Yes TMI No Yes Tunes Technology
## 848
## 2836 Yes No No Mysterious No Yes Tunes People
## 4052 No Yes
## 4093 Tunes People
## 5509
## Q113181 Q112478 Q112512 Q112270 Q111848 Q111580 Q111220 Q110740
## 193 No Yes Yes Yes Supportive No Mac
## 848
## 2836 Yes Yes Yes No Yes Demanding Yes PC
## 4052
## 4093 Yes Supportive
## 5509
## Q109367 Q108950 Q109244 Q108855 Q108617 Q108856 Q108754
## 193 No Cautious No Yes! No Socialize No
## 848 Yes Risk-friendly Yes Yes! No Space No
## 2836 Yes Cautious Yes Yes
## 4052
## 4093 No Risk-friendly No Yes! No Space No
## 5509
## Q108342 Q108343 Q107869 Q107491 Q106993 Q106997 Q106272 Q106388
## 193 In-person No Yes Yes No Yay people! Yes Yes
## 848 In-person Yes
## 2836 In-person Yes Yes Yes No
## 4052 No Grrr people
## 4093 In-person Yes Yes Yes Yes Yay people! Yes Yes
## 5509
## Q106389 Q106042 Q105840 Q105655 Q104996 Q103293 Q102906 Q102674
## 193 No Yes No No Yes No No No
## 848
## 2836 Yes No No No Yes Yes No No
## 4052 No No No No
## 4093 No No No No Yes No No Yes
## 5509
## Q102687 Q102289 Q102089 Q101162 Q101163 Q101596 Q100689 Q100680
## 193 No No Own Optimist Dad Yes Yes No
## 848
## 2836 Yes Yes Rent Optimist Dad No Yes Yes
## 4052 Yes Own No
## 4093 Yes Yes Rent No Yes
## 5509
## Q100562 Q99982 Q100010 Q99716 Q99581 Q99480 Q98869 Q98578 Q98059
## 193 Yes Check! No No No Yes Yes No Yes
## 848
## 2836 Yes Check! No No No Yes Yes Yes
## 4052
## 4093 No Nope Yes No Yes Yes Yes No Yes
## 5509
## Q98078 Q98197 Q96024
## 193 No Yes Yes
## 848 No
## 2836 Yes Yes No
## 4052
## 4093 Yes Yes No
## 5509
## USER_ID YOB Gender Income HouseholdStatus
## 5563 6955 1966 Male over $150,000 Married (w/kids)
## 5564 6956 NA Male
## 5565 6957 2000 Female
## 5566 6958 1969 Male over $150,000
## 5567 6959 1986 Male $25,001 - $50,000 Married (w/kids)
## 5568 6960 1999 Male under $25,000 Single (no kids)
## EducationLevel Party Q124742 Q124122 Q123464 Q123621
## 5563 Bachelor's Degree Democrat
## 5564 Master's Degree Democrat No No
## 5565 Current K-12 Republican
## 5566 Bachelor's Degree Democrat Yes
## 5567 High School Diploma Republican
## 5568 Current K-12 Republican
## Q122769 Q122770 Q122771 Q122120 Q121699 Q121700 Q120978 Q121011
## 5563 No Yes No Yes Yes
## 5564 No Yes Public Yes
## 5565 Public Yes
## 5566 No No No Yes Yes
## 5567 Yes Yes No
## 5568 Yes No No
## Q120379 Q120650 Q120472 Q120194 Q120012 Q120014 Q119334 Q119851
## 5563
## 5564
## 5565 Yes Yes Art Try first No Yes Yes Yes
## 5566 Yes Yes Science
## 5567 No No Science No Yes
## 5568
## Q119650 Q118892 Q118117 Q118232 Q118233 Q118237 Q117186 Q117193
## 5563
## 5564
## 5565 Receiving
## 5566
## 5567
## 5568
## Q116797 Q116881 Q116953 Q116601 Q116441 Q116448 Q116197 Q115602
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q115777 Q115610 Q115611 Q115899 Q115390 Q114961 Q114748 Q115195
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q114517 Q114386 Q113992 Q114152 Q113583 Q113584 Q113181 Q112478
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q112512 Q112270 Q111848 Q111580 Q111220 Q110740 Q109367 Q108950
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q109244 Q108855 Q108617 Q108856 Q108754 Q108342 Q108343 Q107869
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q107491 Q106993 Q106997 Q106272 Q106388 Q106389 Q106042 Q105840
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q105655 Q104996 Q103293 Q102906 Q102674 Q102687 Q102289 Q102089
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q101162 Q101163 Q101596 Q100689 Q100680 Q100562 Q99982 Q100010 Q99716
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q99581 Q99480 Q98869 Q98578 Q98059 Q98078 Q98197 Q96024
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## 'data.frame': 5568 obs. of 20 variables:
## $ USER_ID : int 1 4 5 8 9 10 11 12 13 15 ...
## $ YOB : int 1938 1970 1997 1983 1984 1997 1983 1996 NA 1981 ...
## $ Gender : chr "Male" "Female" "Male" "Male" ...
## $ Income : chr "" "over $150,000" "$75,000 - $100,000" "$100,001 - $150,000" ...
## $ HouseholdStatus: chr "Married (w/kids)" "Domestic Partners (w/kids)" "Single (no kids)" "Married (w/kids)" ...
## $ EducationLevel : chr "" "Bachelor's Degree" "High School Diploma" "Bachelor's Degree" ...
## $ Party : chr "Democrat" "Democrat" "Republican" "Democrat" ...
## $ Q124742 : chr "No" "" "" "No" ...
## $ Q124122 : chr "" "Yes" "Yes" "Yes" ...
## $ Q123464 : chr "No" "No" "Yes" "No" ...
## $ Q123621 : chr "No" "No" "No" "Yes" ...
## $ Q122769 : chr "No" "No" "" "No" ...
## $ Q122770 : chr "Yes" "Yes" "Yes" "No" ...
## $ Q122771 : chr "Public" "Public" "Private" "Public" ...
## $ Q122120 : chr "No" "No" "No" "No" ...
## $ Q121699 : chr "Yes" "Yes" "No" "Yes" ...
## $ Q121700 : chr "No" "No" "No" "No" ...
## $ Q120978 : chr "" "Yes" "Yes" "Yes" ...
## $ Q121011 : chr "No" "No" "No" "No" ...
## $ Q120379 : chr "No" "No" "No" "No" ...
## NULL
## 'data.frame': 5568 obs. of 20 variables:
## $ Q120650: chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q118117: chr "Yes" "No" "Yes" "No" ...
## $ Q118233: chr "No" "No" "No" "No" ...
## $ Q118237: chr "No" "No" "Yes" "No" ...
## $ Q116441: chr "No" "Yes" "No" "No" ...
## $ Q116197: chr "P.M." "A.M." "A.M." "A.M." ...
## $ Q115611: chr "No" "No" "Yes" "No" ...
## $ Q115899: chr "Circumstances" "Me" "Circumstances" "Circumstances" ...
## $ Q115390: chr "Yes" "Yes" "No" "Yes" ...
## $ Q114748: chr "Yes" "No" "No" "No" ...
## $ Q115195: chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q113584: chr "Technology" "" "Technology" "People" ...
## $ Q112478: chr "No" "" "Yes" "Yes" ...
## $ Q112270: chr "" "" "Yes" "Yes" ...
## $ Q111848: chr "No" "" "No" "Yes" ...
## $ Q106993: chr "Yes" "No" "Yes" "Yes" ...
## $ Q106388: chr "No" "Yes" "No" "No" ...
## $ Q105655: chr "No" "No" "No" "Yes" ...
## $ Q104996: chr "Yes" "Yes" "No" "Yes" ...
## $ Q102674: chr "No" "" "No" "No" ...
## NULL
## 'data.frame': 5568 obs. of 21 variables:
## $ Q102674: chr "No" "" "No" "No" ...
## $ Q102687: chr "Yes" "" "Yes" "Yes" ...
## $ Q102289: chr "No" "" "No" "Yes" ...
## $ Q102089: chr "Own" "" "Own" "Own" ...
## $ Q101162: chr "Optimist" "" "Pessimist" "Optimist" ...
## $ Q101163: chr "" "" "Mom" "Mom" ...
## $ Q101596: chr "Yes" "" "No" "No" ...
## $ Q100689: chr "Yes" "" "No" "No" ...
## $ Q100680: chr "No" "" "No" "No" ...
## $ Q100562: chr "No" "" "No" "Yes" ...
## $ Q99982 : chr "Nope" "" "Nope" "Check!" ...
## $ Q100010: chr "Yes" "" "Yes" "No" ...
## $ Q99716 : chr "No" "" "No" "No" ...
## $ Q99581 : chr "No" "" "No" "No" ...
## $ Q99480 : chr "" "No" "No" "Yes" ...
## $ Q98869 : chr "No" "No" "Yes" "Yes" ...
## $ Q98578 : chr "" "No" "No" "No" ...
## $ Q98059 : chr "Only-child" "Only-child" "Yes" "Yes" ...
## $ Q98078 : chr "No" "Yes" "No" "No" ...
## $ Q98197 : chr "No" "No" "Yes" "No" ...
## $ Q96024 : chr "Yes" "No" "No" "Yes" ...
## NULL
## Warning in myprint_str_df(obsDf): [list output truncated]
## [1] "Reading file ./data/test2016.csv..."
## [1] "dimensions of data in ./data/test2016.csv: 1,392 rows x 107 cols"
## USER_ID YOB Gender Income HouseholdStatus
## 1 2 1985 Female $25,001 - $50,000 Single (no kids)
## 2 3 1983 Male $50,000 - $74,999 Married (w/kids)
## 3 6 1995 Male $75,000 - $100,000 Single (no kids)
## 4 7 1980 Female $50,000 - $74,999 Single (no kids)
## 5 14 1980 Female Married (no kids)
## 6 28 1973 Male over $150,000 Married (no kids)
## EducationLevel Q124742 Q124122 Q123464 Q123621 Q122769 Q122770
## 1 Master's Degree Yes No Yes No No
## 2 Current Undergraduate No Yes Yes
## 3 Current K-12
## 4 Master's Degree Yes Yes No Yes Yes Yes
## 5 Current Undergraduate Yes No Yes No No
## 6 Master's Degree No Yes No Yes No No
## Q122771 Q122120 Q121699 Q121700 Q120978 Q121011 Q120379 Q120650 Q120472
## 1 Public No Yes Yes Yes No Yes Yes Science
## 2 Public No Yes No
## 3 No No No Yes No Yes Science
## 4 Public No Yes No Yes No Yes Yes Science
## 5 Public Yes Yes No Yes Yes No Yes Art
## 6 Public No Yes No Yes Yes Yes Yes Science
## Q120194 Q120012 Q120014 Q119334 Q119851 Q119650 Q118892 Q118117
## 1 Study first Yes Yes Yes No Giving Yes No
## 2 Study first No Yes No
## 3 Try first No Yes No Yes Giving
## 4 Try first Yes No No Yes Giving Yes Yes
## 5 Try first Yes Yes Yes Yes Giving No No
## 6 Try first Yes Yes No No Giving No Yes
## Q118232 Q118233 Q118237 Q117186 Q117193 Q116797 Q116881
## 1 Idealist No Yes Cool headed Odd hours Yes Happy
## 2
## 3
## 4 Idealist No No Cool headed Standard hours No Happy
## 5 Idealist No Yes Hot headed Standard hours Yes Happy
## 6 Pragmatist Yes No Hot headed Odd hours Yes Right
## Q116953 Q116601 Q116441 Q116448 Q116197 Q115602 Q115777 Q115610 Q115611
## 1 Yes Yes No Yes A.M. Yes End Yes No
## 2 Yes Yes P.M.
## 3 Yes
## 4 Yes No No Yes A.M. Yes Start Yes No
## 5 Yes Yes Yes No P.M. Yes End No No
## 6 Yes Yes Yes Yes P.M. End Yes Yes
## Q115899 Q115390 Q114961 Q114748 Q115195 Q114517 Q114386 Q113992
## 1 Me No Yes No Yes Yes TMI
## 2 No Yes
## 3 Yes No Yes Yes No TMI No
## 4 Me Yes No Yes Yes Yes TMI No
## 5 Me No No No Yes No TMI No
## 6 Circumstances No Yes No Yes No TMI Yes
## Q114152 Q113583 Q113584 Q113181 Q112478 Q112512 Q112270 Q111848
## 1 No Tunes People Yes Yes No Yes Yes
## 2 No No No Yes
## 3 No Tunes Technology Yes No Yes No
## 4 Yes Talk People No No Yes No Yes
## 5 Tunes Technology No Yes Yes Yes
## 6 No Talk Technology No Yes Yes No Yes
## Q111580 Q111220 Q110740 Q109367 Q108950 Q109244 Q108855 Q108617
## 1 Supportive No Yes Cautious Yes Yes!
## 2 No Yes Cautious No Yes! No
## 3 No No No
## 4 Supportive No PC No Cautious Yes Yes! No
## 5 Supportive Yes Mac Yes Cautious No Yes! No
## 6 Demanding No PC Yes Cautious No Umm... No
## Q108856 Q108754 Q108342 Q108343 Q107869 Q107491 Q106993 Q106997
## 1 Yes In-person Yes
## 2 Space No Yes Yes Yes Grrr people
## 3 Yes In-person No No Yes Yes Yay people!
## 4 Space No Online No No Yes Yes Yay people!
## 5 Space No In-person No No Yes No Grrr people
## 6 Space No In-person Yes Yes Yes Grrr people
## Q106272 Q106388 Q106389 Q106042 Q105840 Q105655 Q104996 Q103293 Q102906
## 1
## 2 Yes No No Yes No Yes No No
## 3 Yes No Yes No No Yes Yes No No
## 4 No No No No No Yes Yes No No
## 5 No No No Yes Yes Yes Yes Yes No
## 6 Yes No Yes Yes No No No Yes Yes
## Q102674 Q102687 Q102289 Q102089 Q101162 Q101163 Q101596 Q100689
## 1 No
## 2 Rent Pessimist Dad
## 3 No No Yes Own Optimist Mom No No
## 4 No No No Own Optimist Dad No No
## 5 Yes No No Own Pessimist Mom No Yes
## 6 Yes Yes No Own Pessimist Mom No Yes
## Q100680 Q100562 Q99982 Q100010 Q99716 Q99581 Q99480 Q98869 Q98578 Q98059
## 1 Yes Yes Yes
## 2 Yes Yes Yes
## 3 Yes Yes Nope No No No Yes Yes No Yes
## 4 Yes Yes Nope Yes No No No Yes No Yes
## 5 Yes Yes Nope Yes No No Yes No No Yes
## 6 Yes Yes Nope Yes No No Yes No No Yes
## Q98078 Q98197 Q96024
## 1
## 2 Yes No Yes
## 3 No Yes Yes
## 4 No No Yes
## 5 No No No
## 6 No No Yes
## USER_ID YOB Gender Income HouseholdStatus
## 503 2555 1956 Male over $150,000 Married (w/kids)
## 515 2616 1959 Male over $150,000 Married (w/kids)
## 857 4346 1990 Female $50,000 - $74,999
## 950 4814 1969 Male $75,000 - $100,000 Married (w/kids)
## 1207 6057 1937 Female $25,001 - $50,000 Married (no kids)
## 1255 6285 1976 Female $100,001 - $150,000 Married (no kids)
## EducationLevel Q124742 Q124122 Q123464 Q123621 Q122769 Q122770
## 503 Bachelor's Degree No No No Yes No Yes
## 515 Bachelor's Degree
## 857 Bachelor's Degree
## 950 Bachelor's Degree Yes No Yes No No
## 1207 Bachelor's Degree No Yes
## 1255 Bachelor's Degree
## Q122771 Q122120 Q121699 Q121700 Q120978 Q121011 Q120379 Q120650
## 503 Private No Yes No No Yes No Yes
## 515 No No
## 857 No Yes No No No No Yes
## 950 Public Yes Yes No Yes Yes No Yes
## 1207 Public No Yes No No No No
## 1255
## Q120472 Q120194 Q120012 Q120014 Q119334 Q119851 Q119650 Q118892
## 503 Science Study first No Yes No Yes Giving Yes
## 515 Yes
## 857 Science Study first No No Yes No Receiving Yes
## 950 Science Study first No No No No Giving No
## 1207 Study first No No Yes Receiving Yes
## 1255
## Q118117 Q118232 Q118233 Q118237 Q117186 Q117193 Q116797
## 503 No Pragmatist No No Cool headed Standard hours No
## 515 No Pragmatist No Yes Cool headed Standard hours No
## 857 Yes Pragmatist No No Cool headed Odd hours No
## 950 No Pragmatist No Yes Hot headed Odd hours Yes
## 1207 No Pragmatist No No Hot headed No
## 1255
## Q116881 Q116953 Q116601 Q116441 Q116448 Q116197 Q115602 Q115777
## 503 Happy Yes Yes No No A.M. Yes End
## 515 Right Yes Yes No Yes Yes
## 857 Right Yes Yes No No A.M. Yes Start
## 950 Happy Yes Yes Yes No P.M. Yes Start
## 1207 Happy Yes Yes No No A.M. Yes Start
## 1255 Yes No Yes A.M. Yes Start
## Q115610 Q115611 Q115899 Q115390 Q114961 Q114748 Q115195 Q114517
## 503 Yes Yes Me No No No Yes Yes
## 515 Yes No Me Yes No Yes Yes No
## 857 Yes No Me No No No Yes
## 950 Yes No Me Yes No Yes No No
## 1207 No No Circumstances Yes No Yes No Yes
## 1255 Yes No Circumstances No Yes No Yes Yes
## Q114386 Q113992 Q114152 Q113583 Q113584 Q113181 Q112478 Q112512
## 503 TMI Yes Yes Tunes People Yes No Yes
## 515 No Yes Talk Technology
## 857 Mysterious No No Tunes People No No No
## 950 Mysterious No No Tunes People Yes Yes Yes
## 1207 Yes No Talk Yes
## 1255 TMI Yes Yes Yes
## Q112270 Q111848 Q111580 Q111220 Q110740 Q109367 Q108950
## 503 No Yes Demanding No PC No Cautious
## 515 No Yes No Mac Yes
## 857 Yes Yes Supportive No Mac No Risk-friendly
## 950 No Yes Supportive Yes PC No Cautious
## 1207 Supportive No PC Cautious
## 1255 Yes Yes Demanding No Mac
## Q109244 Q108855 Q108617 Q108856 Q108754 Q108342 Q108343 Q107869
## 503 No Umm... No Space No In-person No Yes
## 515
## 857 Yes Umm... No Space No In-person No Yes
## 950 No Yes! No Space No In-person No No
## 1207 Yes! No Space No In-person No Yes
## 1255
## Q107491 Q106993 Q106997 Q106272 Q106388 Q106389 Q106042 Q105840
## 503 Yes Yes Yay people! Yes No No Yes No
## 515 No
## 857 No Yes Grrr people Yes No Yes No No
## 950 Yes No Grrr people Yes Yes No No No
## 1207 Yes Yes Yes
## 1255
## Q105655 Q104996 Q103293 Q102906 Q102674 Q102687 Q102289 Q102089
## 503 No Yes No No No Yes No Own
## 515 Yes Yes
## 857 No Yes Yes No No Yes Yes Own
## 950 Yes Yes Yes No No Yes No Own
## 1207 Yes
## 1255
## Q101162 Q101163 Q101596 Q100689 Q100680 Q100562 Q99982 Q100010
## 503 Pessimist Mom Yes Yes No Yes Check! Yes
## 515 Check! Yes
## 857 Optimist Mom No Yes Yes No Nope Yes
## 950 Pessimist Mom Yes No No No Check! Yes
## 1207
## 1255
## Q99716 Q99581 Q99480 Q98869 Q98578 Q98059 Q98078 Q98197 Q96024
## 503 No No Yes Yes No Yes Yes Yes Yes
## 515 No Yes Yes Yes No Yes Yes
## 857 No Yes Yes Yes No Yes No No No
## 950 No No Yes Yes No Yes No Yes Yes
## 1207
## 1255
## USER_ID YOB Gender Income HouseholdStatus
## 1387 6922 1988 Male $50,000 - $74,999 Single (no kids)
## 1388 6928 1977 Female $50,000 - $74,999 Domestic Partners (no kids)
## 1389 6930 1998 Female $100,001 - $150,000 Single (no kids)
## 1390 6941 1989 Male $25,001 - $50,000 Married (no kids)
## 1391 6946 1996 Male
## 1392 6947 NA Female
## EducationLevel Q124742 Q124122 Q123464 Q123621 Q122769 Q122770
## 1387 Master's Degree
## 1388 Master's Degree
## 1389 Current K-12 No No
## 1390 Bachelor's Degree
## 1391 Current K-12
## 1392 Yes Yes No No No No
## Q122771 Q122120 Q121699 Q121700 Q120978 Q121011 Q120379 Q120650
## 1387 Yes Yes Yes Yes Yes Yes
## 1388 Yes No Yes
## 1389 Public Yes Yes Yes Yes Yes Yes Yes
## 1390 Yes Yes No No No
## 1391 Yes No No Yes No Yes Yes
## 1392 Public Yes Yes No Yes Yes Yes Yes
## Q120472 Q120194 Q120012 Q120014 Q119334 Q119851 Q119650 Q118892
## 1387 Science Try first No Yes Yes No Giving
## 1388 Art
## 1389 Art Study first Yes No Yes No Giving
## 1390
## 1391 Art Study first Yes Yes Yes No Giving
## 1392 Art No No No Yes Giving
## Q118117 Q118232 Q118233 Q118237 Q117186 Q117193 Q116797 Q116881
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q116953 Q116601 Q116441 Q116448 Q116197 Q115602 Q115777 Q115610
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q115611 Q115899 Q115390 Q114961 Q114748 Q115195 Q114517 Q114386
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q113992 Q114152 Q113583 Q113584 Q113181 Q112478 Q112512 Q112270
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q111848 Q111580 Q111220 Q110740 Q109367 Q108950 Q109244 Q108855
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q108617 Q108856 Q108754 Q108342 Q108343 Q107869 Q107491 Q106993
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q106997 Q106272 Q106388 Q106389 Q106042 Q105840 Q105655 Q104996
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q103293 Q102906 Q102674 Q102687 Q102289 Q102089 Q101162 Q101163
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q101596 Q100689 Q100680 Q100562 Q99982 Q100010 Q99716 Q99581 Q99480
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q98869 Q98578 Q98059 Q98078 Q98197 Q96024
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## 'data.frame': 1392 obs. of 20 variables:
## $ USER_ID : int 2 3 6 7 14 28 29 37 44 56 ...
## $ YOB : int 1985 1983 1995 1980 1980 1973 1968 1961 1989 1975 ...
## $ Gender : chr "Female" "Male" "Male" "Female" ...
## $ Income : chr "$25,001 - $50,000" "$50,000 - $74,999" "$75,000 - $100,000" "$50,000 - $74,999" ...
## $ HouseholdStatus: chr "Single (no kids)" "Married (w/kids)" "Single (no kids)" "Single (no kids)" ...
## $ EducationLevel : chr "Master's Degree" "Current Undergraduate" "Current K-12" "Master's Degree" ...
## $ Q124742 : chr "" "" "" "Yes" ...
## $ Q124122 : chr "Yes" "" "" "Yes" ...
## $ Q123464 : chr "No" "No" "" "No" ...
## $ Q123621 : chr "Yes" "" "" "Yes" ...
## $ Q122769 : chr "No" "Yes" "" "Yes" ...
## $ Q122770 : chr "No" "Yes" "" "Yes" ...
## $ Q122771 : chr "Public" "Public" "" "Public" ...
## $ Q122120 : chr "No" "No" "" "No" ...
## $ Q121699 : chr "Yes" "Yes" "No" "Yes" ...
## $ Q121700 : chr "Yes" "No" "No" "No" ...
## $ Q120978 : chr "Yes" "" "No" "Yes" ...
## $ Q121011 : chr "No" "" "Yes" "No" ...
## $ Q120379 : chr "Yes" "" "No" "Yes" ...
## $ Q120650 : chr "Yes" "" "Yes" "Yes" ...
## NULL
## 'data.frame': 1392 obs. of 20 variables:
## $ Q120012: chr "Yes" "No" "No" "Yes" ...
## $ Q120014: chr "Yes" "Yes" "Yes" "No" ...
## $ Q118117: chr "No" "" "" "Yes" ...
## $ Q118237: chr "Yes" "" "" "No" ...
## $ Q116953: chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q116601: chr "Yes" "Yes" "" "No" ...
## $ Q116448: chr "Yes" "" "" "Yes" ...
## $ Q116197: chr "A.M." "P.M." "" "A.M." ...
## $ Q115899: chr "Me" "" "" "Me" ...
## $ Q114961: chr "Yes" "" "No" "No" ...
## $ Q113584: chr "People" "" "Technology" "People" ...
## $ Q113181: chr "Yes" "No" "Yes" "No" ...
## $ Q112512: chr "No" "" "Yes" "Yes" ...
## $ Q108950: chr "Cautious" "Cautious" "" "Cautious" ...
## $ Q108617: chr "" "No" "No" "No" ...
## $ Q108342: chr "In-person" "" "In-person" "Online" ...
## $ Q107491: chr "" "Yes" "Yes" "Yes" ...
## $ Q106272: chr "" "Yes" "Yes" "No" ...
## $ Q106389: chr "" "No" "Yes" "No" ...
## $ Q104996: chr "" "No" "Yes" "Yes" ...
## NULL
## 'data.frame': 1392 obs. of 21 variables:
## $ Q102674: chr "" "" "No" "No" ...
## $ Q102687: chr "" "" "No" "No" ...
## $ Q102289: chr "" "" "Yes" "No" ...
## $ Q102089: chr "" "Rent" "Own" "Own" ...
## $ Q101162: chr "" "Pessimist" "Optimist" "Optimist" ...
## $ Q101163: chr "" "Dad" "Mom" "Dad" ...
## $ Q101596: chr "" "" "No" "No" ...
## $ Q100689: chr "No" "" "No" "No" ...
## $ Q100680: chr "Yes" "" "Yes" "Yes" ...
## $ Q100562: chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q99982 : chr "" "" "Nope" "Nope" ...
## $ Q100010: chr "" "" "No" "Yes" ...
## $ Q99716 : chr "" "" "No" "No" ...
## $ Q99581 : chr "" "" "No" "No" ...
## $ Q99480 : chr "" "" "Yes" "No" ...
## $ Q98869 : chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q98578 : chr "" "" "No" "No" ...
## $ Q98059 : chr "" "Yes" "Yes" "Yes" ...
## $ Q98078 : chr "" "Yes" "No" "No" ...
## $ Q98197 : chr "" "No" "Yes" "No" ...
## $ Q96024 : chr "" "Yes" "Yes" "Yes" ...
## NULL
## Warning in myprint_str_df(obsDf): [list output truncated]
## [1] "Creating new feature: .pos..."
## [1] "Creating new feature: YOB.Age.fctr..."
## [1] "Creating new feature: YOB.Age.dff..."
## [1] "Creating new feature: Gender.fctr..."
## [1] "Creating new feature: Income.fctr..."
## [1] "Creating new feature: Hhold.fctr..."
## [1] "Creating new feature: Edn.fctr..."
## [1] "Creating new feature: Q124742.fctr..."
## [1] "Creating new feature: Q124122.fctr..."
## [1] "Creating new feature: Q123621.fctr..."
## [1] "Creating new feature: Q123464.fctr..."
## [1] "Creating new feature: Q122771.fctr..."
## [1] "Creating new feature: Q122770.fctr..."
## [1] "Creating new feature: Q122769.fctr..."
## [1] "Creating new feature: Q122120.fctr..."
## [1] "Creating new feature: Q121700.fctr..."
## [1] "Creating new feature: Q121699.fctr..."
## [1] "Creating new feature: Q121011.fctr..."
## [1] "Creating new feature: Q120978.fctr..."
## [1] "Creating new feature: Q120650.fctr..."
## [1] "Creating new feature: Q120472.fctr..."
## [1] "Creating new feature: Q120379.fctr..."
## [1] "Creating new feature: Q120194.fctr..."
## [1] "Creating new feature: Q120014.fctr..."
## [1] "Creating new feature: Q120012.fctr..."
## [1] "Creating new feature: Q119851.fctr..."
## [1] "Creating new feature: Q119650.fctr..."
## [1] "Creating new feature: Q119334.fctr..."
## [1] "Creating new feature: Q118892.fctr..."
## [1] "Creating new feature: Q118237.fctr..."
## [1] "Creating new feature: Q118233.fctr..."
## [1] "Creating new feature: Q118232.fctr..."
## [1] "Creating new feature: Q118117.fctr..."
## [1] "Creating new feature: Q117193.fctr..."
## [1] "Creating new feature: Q117186.fctr..."
## [1] "Creating new feature: Q116797.fctr..."
## [1] "Creating new feature: Q116881.fctr..."
## [1] "Creating new feature: Q116953.fctr..."
## [1] "Creating new feature: Q116601.fctr..."
## [1] "Creating new feature: Q116441.fctr..."
## [1] "Creating new feature: Q116448.fctr..."
## [1] "Creating new feature: Q116197.fctr..."
## [1] "Creating new feature: Q115602.fctr..."
## [1] "Creating new feature: Q115777.fctr..."
## [1] "Creating new feature: Q115610.fctr..."
## [1] "Creating new feature: Q115611.fctr..."
## [1] "Creating new feature: Q115899.fctr..."
## [1] "Creating new feature: Q115390.fctr..."
## [1] "Creating new feature: Q115195.fctr..."
## [1] "Creating new feature: Q114961.fctr..."
## [1] "Creating new feature: Q114748.fctr..."
## [1] "Creating new feature: Q114517.fctr..."
## [1] "Creating new feature: Q114386.fctr..."
## [1] "Creating new feature: Q114152.fctr..."
## [1] "Creating new feature: Q113992.fctr..."
## [1] "Creating new feature: Q113583.fctr..."
## [1] "Creating new feature: Q113584.fctr..."
## [1] "Creating new feature: Q113181.fctr..."
## [1] "Creating new feature: Q112478.fctr..."
## [1] "Creating new feature: Q112512.fctr..."
## [1] "Creating new feature: Q112270.fctr..."
## [1] "Creating new feature: Q111848.fctr..."
## [1] "Creating new feature: Q111580.fctr..."
## [1] "Creating new feature: Q111220.fctr..."
## [1] "Creating new feature: Q110740.fctr..."
## [1] "Creating new feature: Q109367.fctr..."
## [1] "Creating new feature: Q109244.fctr..."
## [1] "Creating new feature: Q108950.fctr..."
## [1] "Creating new feature: Q108855.fctr..."
## [1] "Creating new feature: Q108617.fctr..."
## [1] "Creating new feature: Q108856.fctr..."
## [1] "Creating new feature: Q108754.fctr..."
## [1] "Creating new feature: Q108342.fctr..."
## [1] "Creating new feature: Q108343.fctr..."
## [1] "Creating new feature: Q107869.fctr..."
## [1] "Creating new feature: Q107491.fctr..."
## [1] "Creating new feature: Q106993.fctr..."
## [1] "Creating new feature: Q106997.fctr..."
## [1] "Creating new feature: Q106272.fctr..."
## [1] "Creating new feature: Q106388.fctr..."
## [1] "Creating new feature: Q106389.fctr..."
## [1] "Creating new feature: Q106042.fctr..."
## [1] "Creating new feature: Q105840.fctr..."
## [1] "Creating new feature: Q105655.fctr..."
## [1] "Creating new feature: Q104996.fctr..."
## [1] "Creating new feature: Q103293.fctr..."
## [1] "Creating new feature: Q102906.fctr..."
## [1] "Creating new feature: Q102674.fctr..."
## [1] "Creating new feature: Q102687.fctr..."
## [1] "Creating new feature: Q102289.fctr..."
## [1] "Creating new feature: Q102089.fctr..."
## [1] "Creating new feature: Q101162.fctr..."
## [1] "Creating new feature: Q101163.fctr..."
## [1] "Creating new feature: Q101596.fctr..."
## [1] "Creating new feature: Q100689.fctr..."
## [1] "Creating new feature: Q100680.fctr..."
## [1] "Creating new feature: Q100562.fctr..."
## [1] "Creating new feature: Q100010.fctr..."
## [1] "Creating new feature: Q99982.fctr..."
## [1] "Creating new feature: Q99716.fctr..."
## [1] "Creating new feature: Q99581.fctr..."
## [1] "Creating new feature: Q99480.fctr..."
## [1] "Creating new feature: Q98869.fctr..."
## [1] "Creating new feature: Q98578.fctr..."
## [1] "Creating new feature: Q98197.fctr..."
## [1] "Creating new feature: Q98059.fctr..."
## [1] "Creating new feature: Q98078.fctr..."
## [1] "Creating new feature: Q96024.fctr..."
## [1] "Partition stats:"
## Loading required package: sqldf
## Loading required package: gsubfn
## Loading required package: proto
## Loading required package: RSQLite
## Loading required package: DBI
## Loading required package: tcltk
## Party .src .n
## 1 Democrat Train 2951
## 2 Republican Train 2617
## 3 <NA> Test 1392
## Party .src .n
## 1 Democrat Train 2951
## 2 Republican Train 2617
## 3 <NA> Test 1392
## Loading required package: RColorBrewer
## .src .n
## 1 Train 5568
## 2 Test 1392
## [1] "Running glbObsDropCondition filter: (is.na(glbObsAll[, \"Q109244\"]) | (glbObsAll[, \"Q109244\"] != \"No\"))"
## [1] "Partition stats:"
## Party .src .n
## 1 Republican Train 1421
## 2 Democrat Train 1038
## 3 <NA> Test 622
## Party .src .n
## 1 Republican Train 1421
## 2 Democrat Train 1038
## 3 <NA> Test 622
## .src .n
## 1 Train 2459
## 2 Test 622
## Loading required package: lazyeval
## Loading required package: gdata
## gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.
##
## gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.
##
## Attaching package: 'gdata'
## The following objects are masked from 'package:dplyr':
##
## combine, first, last
## The following object is masked from 'package:stats':
##
## nobs
## The following object is masked from 'package:utils':
##
## object.size
## [1] "Found 0 duplicates by all features:"
## NULL
## label step_major step_minor label_minor bgn end elapsed
## 1 import.data 1 0 0 6.566 13.729 7.163
## 2 inspect.data 2 0 0 13.729 NA NA
2.0: inspect data## Warning: Removed 622 rows containing non-finite values (stat_count).
## Loading required package: reshape2
## Party.Democrat Party.Republican Party.NA
## Test NA NA 622
## Train 1038 1421 NA
## Party.Democrat Party.Republican Party.NA
## Test NA NA 1
## Train 0.4221228 0.5778772 NA
## [1] "numeric data missing in : "
## YOB
## 128
## [1] "numeric data w/ 0s in : "
## YOB.Age.dff
## 136
## [1] "numeric data w/ Infs in : "
## named integer(0)
## [1] "numeric data w/ NaNs in : "
## named integer(0)
## [1] "string data missing in : "
## Gender Income HouseholdStatus EducationLevel
## 46 445 177 410
## Party Q124742 Q124122 Q123464
## NA 1438 823 708
## Q123621 Q122769 Q122770 Q122771
## 778 644 594 587
## Q122120 Q121699 Q121700 Q120978
## 585 547 563 599
## Q121011 Q120379 Q120650 Q120472
## 571 607 655 649
## Q120194 Q120012 Q120014 Q119334
## 654 591 641 568
## Q119851 Q119650 Q118892 Q118117
## 540 578 486 479
## Q118232 Q118233 Q118237 Q117186
## 701 554 539 648
## Q117193 Q116797 Q116881 Q116953
## 655 590 635 616
## Q116601 Q116441 Q116448 Q116197
## 534 541 560 551
## Q115602 Q115777 Q115610 Q115611
## 539 578 537 487
## Q115899 Q115390 Q114961 Q114748
## 573 619 538 447
## Q115195 Q114517 Q114386 Q113992
## 525 481 521 447
## Q114152 Q113583 Q113584 Q113181
## 537 514 512 453
## Q112478 Q112512 Q112270 Q111848
## 494 460 521 398
## Q111580 Q111220 Q110740 Q109367
## 474 379 357 168
## Q108950 Q109244 Q108855 Q108617
## 204 0 438 288
## Q108856 Q108754 Q108342 Q108343
## 436 338 341 333
## Q107869 Q107491 Q106993 Q106997
## 389 366 389 396
## Q106272 Q106388 Q106389 Q106042
## 426 476 495 451
## Q105840 Q105655 Q104996 Q103293
## 487 393 400 431
## Q102906 Q102674 Q102687 Q102289
## 493 511 475 484
## Q102089 Q101162 Q101163 Q101596
## 462 498 572 477
## Q100689 Q100680 Q100562 Q99982
## 414 497 487 514
## Q100010 Q99716 Q99581 Q99480
## 445 500 466 478
## Q98869 Q98578 Q98059 Q98078
## 564 542 450 569
## Q98197 Q96024
## 528 550
## Party Party.fctr .n
## 1 Republican R 1421
## 2 Democrat D 1038
## 3 <NA> <NA> 622
## Warning: Removed 1 rows containing missing values (position_stack).
## Party.fctr.D Party.fctr.R Party.fctr.NA
## Test NA NA 622
## Train 1038 1421 NA
## Party.fctr.D Party.fctr.R Party.fctr.NA
## Test NA NA 1
## Train 0.4221228 0.5778772 NA
## [1] "elapsed Time (secs): 4.219000"
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## [1] "elapsed Time (secs): 140.434000"
## [1] "elapsed Time (secs): 140.434000"
## label step_major step_minor label_minor bgn end elapsed
## 2 inspect.data 2 0 0 13.729 160.469 146.74
## 3 scrub.data 2 1 1 160.470 NA NA
2.1: scrub data## [1] "numeric data missing in : "
## YOB Party.fctr
## 128 622
## [1] "numeric data w/ 0s in : "
## YOB.Age.dff
## 136
## [1] "numeric data w/ Infs in : "
## named integer(0)
## [1] "numeric data w/ NaNs in : "
## named integer(0)
## [1] "string data missing in : "
## Gender Income HouseholdStatus EducationLevel
## 46 445 177 410
## Party Q124742 Q124122 Q123464
## NA 1438 823 708
## Q123621 Q122769 Q122770 Q122771
## 778 644 594 587
## Q122120 Q121699 Q121700 Q120978
## 585 547 563 599
## Q121011 Q120379 Q120650 Q120472
## 571 607 655 649
## Q120194 Q120012 Q120014 Q119334
## 654 591 641 568
## Q119851 Q119650 Q118892 Q118117
## 540 578 486 479
## Q118232 Q118233 Q118237 Q117186
## 701 554 539 648
## Q117193 Q116797 Q116881 Q116953
## 655 590 635 616
## Q116601 Q116441 Q116448 Q116197
## 534 541 560 551
## Q115602 Q115777 Q115610 Q115611
## 539 578 537 487
## Q115899 Q115390 Q114961 Q114748
## 573 619 538 447
## Q115195 Q114517 Q114386 Q113992
## 525 481 521 447
## Q114152 Q113583 Q113584 Q113181
## 537 514 512 453
## Q112478 Q112512 Q112270 Q111848
## 494 460 521 398
## Q111580 Q111220 Q110740 Q109367
## 474 379 357 168
## Q108950 Q109244 Q108855 Q108617
## 204 0 438 288
## Q108856 Q108754 Q108342 Q108343
## 436 338 341 333
## Q107869 Q107491 Q106993 Q106997
## 389 366 389 396
## Q106272 Q106388 Q106389 Q106042
## 426 476 495 451
## Q105840 Q105655 Q104996 Q103293
## 487 393 400 431
## Q102906 Q102674 Q102687 Q102289
## 493 511 475 484
## Q102089 Q101162 Q101163 Q101596
## 462 498 572 477
## Q100689 Q100680 Q100562 Q99982
## 414 497 487 514
## Q100010 Q99716 Q99581 Q99480
## 445 500 466 478
## Q98869 Q98578 Q98059 Q98078
## 564 542 450 569
## Q98197 Q96024
## 528 550
## label step_major step_minor label_minor bgn end elapsed
## 3 scrub.data 2 1 1 160.470 197.292 36.822
## 4 transform.data 2 2 2 197.293 NA NA
2.2: transform data## label step_major step_minor label_minor bgn end
## 4 transform.data 2 2 2 197.293 197.335
## 5 extract.features 3 0 0 197.335 NA
## elapsed
## 4 0.042
## 5 NA
3.0: extract features## label step_major step_minor label_minor bgn
## 5 extract.features 3 0 0 197.335
## 6 extract.features.datetime 3 1 1 197.356
## end elapsed
## 5 197.356 0.021
## 6 NA NA
3.1: extract features datetime## label step_major step_minor label_minor bgn
## 1 extract.features.datetime.bgn 1 0 0 197.384
## end elapsed
## 1 NA NA
## label step_major step_minor label_minor bgn
## 6 extract.features.datetime 3 1 1 197.356
## 7 extract.features.image 3 2 2 197.396
## end elapsed
## 6 197.396 0.04
## 7 NA NA
3.2: extract features image## label step_major step_minor label_minor bgn end
## 1 extract.features.image.bgn 1 0 0 197.429 NA
## elapsed
## 1 NA
## label step_major step_minor label_minor bgn
## 1 extract.features.image.bgn 1 0 0 197.429
## 2 extract.features.image.end 2 0 0 197.439
## end elapsed
## 1 197.439 0.01
## 2 NA NA
## label step_major step_minor label_minor bgn
## 1 extract.features.image.bgn 1 0 0 197.429
## 2 extract.features.image.end 2 0 0 197.439
## end elapsed
## 1 197.439 0.01
## 2 NA NA
## label step_major step_minor label_minor bgn end
## 7 extract.features.image 3 2 2 197.396 197.449
## 8 extract.features.price 3 3 3 197.450 NA
## elapsed
## 7 0.053
## 8 NA
3.3: extract features price## label step_major step_minor label_minor bgn end
## 1 extract.features.price.bgn 1 0 0 197.476 NA
## elapsed
## 1 NA
## label step_major step_minor label_minor bgn end
## 8 extract.features.price 3 3 3 197.450 197.485
## 9 extract.features.text 3 4 4 197.486 NA
## elapsed
## 8 0.035
## 9 NA
3.4: extract features text## label step_major step_minor label_minor bgn end
## 1 extract.features.text.bgn 1 0 0 197.529 NA
## elapsed
## 1 NA
## Warning in rm(tmp_allobs_df): object 'tmp_allobs_df' not found
## Warning in rm(tmp_trnobs_df): object 'tmp_trnobs_df' not found
## label step_major step_minor label_minor bgn
## 9 extract.features.text 3 4 4 197.486
## 10 extract.features.string 3 5 5 197.543
## end elapsed
## 9 197.542 0.056
## 10 NA NA
3.5: extract features string## label step_major step_minor label_minor bgn
## 1 extract.features.string.bgn 1 0 0 197.578
## end elapsed
## 1 NA NA
## label step_major step_minor
## 1 extract.features.string.bgn 1 0
## 2 extract.features.stringfactorize.str.vars 2 0
## label_minor bgn end elapsed
## 1 0 197.578 197.587 0.009
## 2 0 197.588 NA NA
## Gender Income HouseholdStatus EducationLevel
## "Gender" "Income" "HouseholdStatus" "EducationLevel"
## Party Q124742 Q124122 Q123464
## "Party" "Q124742" "Q124122" "Q123464"
## Q123621 Q122769 Q122770 Q122771
## "Q123621" "Q122769" "Q122770" "Q122771"
## Q122120 Q121699 Q121700 Q120978
## "Q122120" "Q121699" "Q121700" "Q120978"
## Q121011 Q120379 Q120650 Q120472
## "Q121011" "Q120379" "Q120650" "Q120472"
## Q120194 Q120012 Q120014 Q119334
## "Q120194" "Q120012" "Q120014" "Q119334"
## Q119851 Q119650 Q118892 Q118117
## "Q119851" "Q119650" "Q118892" "Q118117"
## Q118232 Q118233 Q118237 Q117186
## "Q118232" "Q118233" "Q118237" "Q117186"
## Q117193 Q116797 Q116881 Q116953
## "Q117193" "Q116797" "Q116881" "Q116953"
## Q116601 Q116441 Q116448 Q116197
## "Q116601" "Q116441" "Q116448" "Q116197"
## Q115602 Q115777 Q115610 Q115611
## "Q115602" "Q115777" "Q115610" "Q115611"
## Q115899 Q115390 Q114961 Q114748
## "Q115899" "Q115390" "Q114961" "Q114748"
## Q115195 Q114517 Q114386 Q113992
## "Q115195" "Q114517" "Q114386" "Q113992"
## Q114152 Q113583 Q113584 Q113181
## "Q114152" "Q113583" "Q113584" "Q113181"
## Q112478 Q112512 Q112270 Q111848
## "Q112478" "Q112512" "Q112270" "Q111848"
## Q111580 Q111220 Q110740 Q109367
## "Q111580" "Q111220" "Q110740" "Q109367"
## Q108950 Q109244 Q108855 Q108617
## "Q108950" "Q109244" "Q108855" "Q108617"
## Q108856 Q108754 Q108342 Q108343
## "Q108856" "Q108754" "Q108342" "Q108343"
## Q107869 Q107491 Q106993 Q106997
## "Q107869" "Q107491" "Q106993" "Q106997"
## Q106272 Q106388 Q106389 Q106042
## "Q106272" "Q106388" "Q106389" "Q106042"
## Q105840 Q105655 Q104996 Q103293
## "Q105840" "Q105655" "Q104996" "Q103293"
## Q102906 Q102674 Q102687 Q102289
## "Q102906" "Q102674" "Q102687" "Q102289"
## Q102089 Q101162 Q101163 Q101596
## "Q102089" "Q101162" "Q101163" "Q101596"
## Q100689 Q100680 Q100562 Q99982
## "Q100689" "Q100680" "Q100562" "Q99982"
## Q100010 Q99716 Q99581 Q99480
## "Q100010" "Q99716" "Q99581" "Q99480"
## Q98869 Q98578 Q98059 Q98078
## "Q98869" "Q98578" "Q98059" "Q98078"
## Q98197 Q96024 .src
## "Q98197" "Q96024" ".src"
## label step_major step_minor label_minor bgn
## 10 extract.features.string 3 5 5 197.543
## 11 extract.features.end 3 6 6 197.610
## end elapsed
## 10 197.609 0.066
## 11 NA NA
3.6: extract features end## time trans "bgn " "fit.data.training.all " "predict.data.new " "end "
## 0.0000 multiple enabled transitions: data.training.all data.new model.selected firing: data.training.all
## 1.0000 1 2 1 0 0
## 1.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction firing: data.new
## 2.0000 2 1 1 1 0
## label step_major step_minor label_minor bgn end
## 11 extract.features.end 3 6 6 197.610 198.543
## 12 manage.missing.data 4 0 0 198.544 NA
## elapsed
## 11 0.933
## 12 NA
4.0: manage missing data## [1] "numeric data missing in : "
## YOB Party.fctr
## 128 622
## [1] "numeric data w/ 0s in : "
## YOB.Age.dff
## 136
## [1] "numeric data w/ Infs in : "
## named integer(0)
## [1] "numeric data w/ NaNs in : "
## named integer(0)
## [1] "string data missing in : "
## Gender Income HouseholdStatus EducationLevel
## 46 445 177 410
## Party Q124742 Q124122 Q123464
## NA 1438 823 708
## Q123621 Q122769 Q122770 Q122771
## 778 644 594 587
## Q122120 Q121699 Q121700 Q120978
## 585 547 563 599
## Q121011 Q120379 Q120650 Q120472
## 571 607 655 649
## Q120194 Q120012 Q120014 Q119334
## 654 591 641 568
## Q119851 Q119650 Q118892 Q118117
## 540 578 486 479
## Q118232 Q118233 Q118237 Q117186
## 701 554 539 648
## Q117193 Q116797 Q116881 Q116953
## 655 590 635 616
## Q116601 Q116441 Q116448 Q116197
## 534 541 560 551
## Q115602 Q115777 Q115610 Q115611
## 539 578 537 487
## Q115899 Q115390 Q114961 Q114748
## 573 619 538 447
## Q115195 Q114517 Q114386 Q113992
## 525 481 521 447
## Q114152 Q113583 Q113584 Q113181
## 537 514 512 453
## Q112478 Q112512 Q112270 Q111848
## 494 460 521 398
## Q111580 Q111220 Q110740 Q109367
## 474 379 357 168
## Q108950 Q109244 Q108855 Q108617
## 204 0 438 288
## Q108856 Q108754 Q108342 Q108343
## 436 338 341 333
## Q107869 Q107491 Q106993 Q106997
## 389 366 389 396
## Q106272 Q106388 Q106389 Q106042
## 426 476 495 451
## Q105840 Q105655 Q104996 Q103293
## 487 393 400 431
## Q102906 Q102674 Q102687 Q102289
## 493 511 475 484
## Q102089 Q101162 Q101163 Q101596
## 462 498 572 477
## Q100689 Q100680 Q100562 Q99982
## 414 497 487 514
## Q100010 Q99716 Q99581 Q99480
## 445 500 466 478
## Q98869 Q98578 Q98059 Q98078
## 564 542 450 569
## Q98197 Q96024
## 528 550
## [1] "numeric data missing in : "
## YOB Party.fctr
## 128 622
## [1] "numeric data w/ 0s in : "
## YOB.Age.dff
## 136
## [1] "numeric data w/ Infs in : "
## named integer(0)
## [1] "numeric data w/ NaNs in : "
## named integer(0)
## [1] "string data missing in : "
## Gender Income HouseholdStatus EducationLevel
## 46 445 177 410
## Party Q124742 Q124122 Q123464
## NA 1438 823 708
## Q123621 Q122769 Q122770 Q122771
## 778 644 594 587
## Q122120 Q121699 Q121700 Q120978
## 585 547 563 599
## Q121011 Q120379 Q120650 Q120472
## 571 607 655 649
## Q120194 Q120012 Q120014 Q119334
## 654 591 641 568
## Q119851 Q119650 Q118892 Q118117
## 540 578 486 479
## Q118232 Q118233 Q118237 Q117186
## 701 554 539 648
## Q117193 Q116797 Q116881 Q116953
## 655 590 635 616
## Q116601 Q116441 Q116448 Q116197
## 534 541 560 551
## Q115602 Q115777 Q115610 Q115611
## 539 578 537 487
## Q115899 Q115390 Q114961 Q114748
## 573 619 538 447
## Q115195 Q114517 Q114386 Q113992
## 525 481 521 447
## Q114152 Q113583 Q113584 Q113181
## 537 514 512 453
## Q112478 Q112512 Q112270 Q111848
## 494 460 521 398
## Q111580 Q111220 Q110740 Q109367
## 474 379 357 168
## Q108950 Q109244 Q108855 Q108617
## 204 0 438 288
## Q108856 Q108754 Q108342 Q108343
## 436 338 341 333
## Q107869 Q107491 Q106993 Q106997
## 389 366 389 396
## Q106272 Q106388 Q106389 Q106042
## 426 476 495 451
## Q105840 Q105655 Q104996 Q103293
## 487 393 400 431
## Q102906 Q102674 Q102687 Q102289
## 493 511 475 484
## Q102089 Q101162 Q101163 Q101596
## 462 498 572 477
## Q100689 Q100680 Q100562 Q99982
## 414 497 487 514
## Q100010 Q99716 Q99581 Q99480
## 445 500 466 478
## Q98869 Q98578 Q98059 Q98078
## 564 542 450 569
## Q98197 Q96024
## 528 550
## label step_major step_minor label_minor bgn end
## 12 manage.missing.data 4 0 0 198.544 199.193
## 13 cluster.data 5 0 0 199.194 NA
## elapsed
## 12 0.65
## 13 NA
5.0: cluster data## Loading required package: proxy
##
## Attaching package: 'proxy'
## The following objects are masked from 'package:stats':
##
## as.dist, dist
## The following object is masked from 'package:base':
##
## as.matrix
## Loading required package: dynamicTreeCut
## Loading required package: entropy
## Loading required package: tidyr
## Loading required package: ggdendro
## [1] "Clustering features: "
## Warning in cor(data.matrix(glbObsAll[glbObsAll$.src == "Train",
## glbFeatsCluster]), : the standard deviation is zero
## abs.cor.y
## Q108855.fctr 0.05525571
## Q116881.fctr 0.05625959
## Q98197.fctr 0.07400689
## Q113181.fctr 0.09842608
## Q115611.fctr 0.10612270
## [1] " .rnorm cor: -0.0049"
## [1] " Clustering entropy measure: Party.fctr"
## [1] "glbObsAll Entropy: 0.6810"
## Q109244.fctr .clusterid Q109244.fctr.clusterid D R .entropy .knt
## 1 No 1 No_1 1038 1421 0.6809679 2459
## [1] "glbObsAll$Q109244.fctr Entropy: 0.6810 (100.0000 pct)"
## [1] "Category: No"
## [1] "max distance(0.9770) pair:"
## USER_ID Party.fctr Q109244.fctr Q124742.fctr Q124122.fctr
## 2961 3680 R No NA NA
## 3852 4799 R No NA NA
## Q123621.fctr Q123464.fctr Q122771.fctr Q122770.fctr Q122769.fctr
## 2961 Yes No Pt Yes No
## 3852 NA NA NA NA NA
## Q122120.fctr Q121700.fctr Q121699.fctr Q121011.fctr Q120978.fctr
## 2961 No No Yes Yes Yes
## 3852 NA NA NA NA NA
## Q120650.fctr Q120472.fctr Q120379.fctr Q120194.fctr Q120014.fctr
## 2961 Yes Science Yes NA Yes
## 3852 NA NA NA NA NA
## Q120012.fctr Q119851.fctr Q119650.fctr Q119334.fctr Q118892.fctr
## 2961 Yes No Giving No Yes
## 3852 NA NA NA Yes No
## Q118237.fctr Q118233.fctr Q118232.fctr Q118117.fctr Q117193.fctr
## 2961 Yes No Pr No Standard hours
## 3852 No Yes NA No Odd hours
## Q117186.fctr Q116797.fctr Q116881.fctr Q116953.fctr Q116601.fctr
## 2961 Hot headed NA NA NA NA
## 3852 Cool headed No Happy No Yes
## Q116441.fctr Q116448.fctr Q116197.fctr Q115602.fctr Q115777.fctr
## 2961 NA NA NA NA Start
## 3852 Yes No NA NA Start
## Q115610.fctr Q115611.fctr Q115899.fctr Q115390.fctr Q115195.fctr
## 2961 NA NA NA NA NA
## 3852 NA NA Me NA NA
## Q114961.fctr Q114748.fctr Q114517.fctr Q114386.fctr Q114152.fctr
## 2961 NA NA NA NA NA
## 3852 NA Yes No Mysterious No
## Q113992.fctr Q113583.fctr Q113584.fctr Q113181.fctr Q112478.fctr
## 2961 NA NA NA NA NA
## 3852 Yes Tunes Technology NA No
## Q112512.fctr Q112270.fctr Q111848.fctr Q111580.fctr Q111220.fctr
## 2961 NA NA NA NA NA
## 3852 Yes Yes No Supportive No
## Q110740.fctr Q109367.fctr Q109244.fctr.1 Q108950.fctr Q108855.fctr
## 2961 NA No No Cautious Umm...
## 3852 PC Yes No NA NA
## Q108617.fctr Q108856.fctr Q108754.fctr Q108342.fctr Q108343.fctr
## 2961 No Space Yes Online No
## 3852 NA NA NA In-person No
## Q107869.fctr Q107491.fctr Q106993.fctr Q106997.fctr Q106272.fctr
## 2961 No Yes Yes Gr NA
## 3852 Yes Yes Yes Gr Yes
## Q106388.fctr Q106389.fctr Q106042.fctr Q105840.fctr Q105655.fctr
## 2961 NA NA NA NA NA
## 3852 Yes Yes NA NA NA
## Q104996.fctr Q103293.fctr Q102906.fctr Q102674.fctr Q102687.fctr
## 2961 NA NA NA NA NA
## 3852 NA NA NA NA NA
## Q102289.fctr Q102089.fctr Q101162.fctr Q101163.fctr Q101596.fctr
## 2961 NA NA NA NA NA
## 3852 Yes Own NA NA NA
## Q100689.fctr Q100680.fctr Q100562.fctr Q100010.fctr Q99982.fctr
## 2961 NA NA NA NA NA
## 3852 Yes No No Yes Check!
## Q99716.fctr Q99581.fctr Q99480.fctr Q98869.fctr Q98578.fctr
## 2961 NA NA NA NA NA
## 3852 Yes No Yes Yes No
## Q98197.fctr Q98059.fctr Q98078.fctr Q96024.fctr
## 2961 NA NA NA NA
## 3852 NA NA NA NA
## [1] "min distance(0.9498) pair:"
## USER_ID Party.fctr Q109244.fctr Q124742.fctr Q124122.fctr
## 1423 1771 D No NA NA
## 4299 5365 R No NA NA
## Q123621.fctr Q123464.fctr Q122771.fctr Q122770.fctr Q122769.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q122120.fctr Q121700.fctr Q121699.fctr Q121011.fctr Q120978.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q120650.fctr Q120472.fctr Q120379.fctr Q120194.fctr Q120014.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q120012.fctr Q119851.fctr Q119650.fctr Q119334.fctr Q118892.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q118237.fctr Q118233.fctr Q118232.fctr Q118117.fctr Q117193.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q117186.fctr Q116797.fctr Q116881.fctr Q116953.fctr Q116601.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q116441.fctr Q116448.fctr Q116197.fctr Q115602.fctr Q115777.fctr
## 1423 NA NA NA Yes Start
## 4299 NA NA NA Yes NA
## Q115610.fctr Q115611.fctr Q115899.fctr Q115390.fctr Q115195.fctr
## 1423 Yes No Cs Yes Yes
## 4299 Yes Yes NA Yes Yes
## Q114961.fctr Q114748.fctr Q114517.fctr Q114386.fctr Q114152.fctr
## 1423 No Yes No TMI NA
## 4299 No No Yes Mysterious Yes
## Q113992.fctr Q113583.fctr Q113584.fctr Q113181.fctr Q112478.fctr
## 1423 Yes NA NA Yes Yes
## 4299 No Talk People Yes NA
## Q112512.fctr Q112270.fctr Q111848.fctr Q111580.fctr Q111220.fctr
## 1423 NA No Yes Supportive NA
## 4299 NA NA NA NA NA
## Q110740.fctr Q109367.fctr Q109244.fctr.1 Q108950.fctr Q108855.fctr
## 1423 NA Yes No NA NA
## 4299 NA Yes No NA NA
## Q108617.fctr Q108856.fctr Q108754.fctr Q108342.fctr Q108343.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q107869.fctr Q107491.fctr Q106993.fctr Q106997.fctr Q106272.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q106388.fctr Q106389.fctr Q106042.fctr Q105840.fctr Q105655.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q104996.fctr Q103293.fctr Q102906.fctr Q102674.fctr Q102687.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q102289.fctr Q102089.fctr Q101162.fctr Q101163.fctr Q101596.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q100689.fctr Q100680.fctr Q100562.fctr Q100010.fctr Q99982.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q99716.fctr Q99581.fctr Q99480.fctr Q98869.fctr Q98578.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q98197.fctr Q98059.fctr Q98078.fctr Q96024.fctr
## 1423 NA NA NA NA
## 4299 NA NA NA NA
## Q109244.fctr .clusterid Q109244.fctr.clusterid D R .entropy .knt
## 1 No 1 No_1 388 704 0.6506727 1092
## 2 No 2 No_2 440 400 0.6920130 840
## 3 No 3 No_3 210 317 0.6723914 527
## [1] "glbObsAll$Q109244.fctr$.clusterid Entropy: 0.6694 (98.3085 pct)"
## label step_major step_minor label_minor bgn
## 13 cluster.data 5 0 0 199.194
## 14 partition.data.training 6 0 0 270.858
## end elapsed
## 13 270.857 71.664
## 14 NA NA
6.0: partition data training## [1] "partition.data.training chunk: setup: elapsed: 0.00 secs"
## [1] "partition.data.training chunk: strata_mtrx complete: elapsed: 0.10 secs"
## [1] "partition.data.training chunk: obs_freq_df complete: elapsed: 0.10 secs"
## Loading required package: sampling
##
## Attaching package: 'sampling'
## The following object is masked from 'package:caret':
##
## cluster
## [1] "lclgetMatrixCorrelation: duration: 10.438000 secs"
## [1] "cor of Fit vs. OOB: 1.0000"
## [1] "lclgetMatrixCorrelation: duration: 5.073000 secs"
## [1] "cor of New vs. OOB: 1.0000"
## [1] "lclgetMatrixCorrelation: duration: 9.930000 secs"
## [1] "cor of Fit vs. New: 1.0000"
## [1] "partition.data.training chunk: Fit/OOB partition complete: elapsed: 25.88 secs"
## Party.Democrat Party.Republican Party.NA
## NA NA 622
## Fit 830 1136 NA
## OOB 208 285 NA
## Party.Democrat Party.Republican Party.NA
## NA NA 1
## Fit 0.4221770 0.5778230 NA
## OOB 0.4219067 0.5780933 NA
## Q109244.fctr .n.Fit .n.OOB .n.Tst .freqRatio.Fit .freqRatio.OOB
## 1 No 1966 493 622 1 1
## .freqRatio.Tst
## 1 1
## [1] "glbObsAll: "
## [1] 3081 222
## [1] "glbObsTrn: "
## [1] 2459 222
## [1] "glbObsFit: "
## [1] 1966 221
## [1] "glbObsOOB: "
## [1] 493 221
## [1] "glbObsNew: "
## [1] 622 221
## [1] "partition.data.training chunk: teardown: elapsed: 26.49 secs"
## label step_major step_minor label_minor bgn
## 14 partition.data.training 6 0 0 270.858
## 15 select.features 7 0 0 297.456
## end elapsed
## 14 297.455 26.597
## 15 NA NA
7.0: select features## Warning in cor(data.matrix(entity_df[, sel_feats]), y =
## as.numeric(entity_df[, : the standard deviation is zero
## [1] "cor(.clusterid.fctr, Q113181.fctr)=-0.7180"
## [1] "cor(Party.fctr, .clusterid.fctr)=-0.0640"
## [1] "cor(Party.fctr, Q113181.fctr)=0.0984"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified .clusterid.fctr as highly correlated with
## Q113181.fctr
## cor.y exclude.as.feat cor.y.abs cor.high.X
## Q115611.fctr 0.1061227024 0 0.1061227024 <NA>
## Q113181.fctr 0.0984260825 0 0.0984260825 <NA>
## Q98197.fctr 0.0740068938 0 0.0740068938 <NA>
## Q116881.fctr 0.0562595864 0 0.0562595864 <NA>
## Q108855.fctr 0.0552557062 0 0.0552557062 <NA>
## Q106272.fctr 0.0508423733 0 0.0508423733 <NA>
## Q122771.fctr 0.0506936997 0 0.0506936997 <NA>
## Q123621.fctr 0.0496371444 0 0.0496371444 <NA>
## Q106388.fctr 0.0494091927 0 0.0494091927 <NA>
## Q110740.fctr 0.0475251274 0 0.0475251274 <NA>
## USER_ID 0.0451253514 1 0.0451253514 <NA>
## .pos 0.0449751220 1 0.0449751220 <NA>
## Q122769.fctr 0.0357238967 0 0.0357238967 <NA>
## Q120472.fctr 0.0353553175 0 0.0353553175 <NA>
## Q101596.fctr 0.0310707949 0 0.0310707949 <NA>
## Q119334.fctr 0.0307545744 0 0.0307545744 <NA>
## Q114152.fctr 0.0298031360 0 0.0298031360 <NA>
## Q98869.fctr 0.0279837842 0 0.0279837842 <NA>
## Q115899.fctr 0.0275355442 0 0.0275355442 <NA>
## Q116797.fctr 0.0264023055 0 0.0264023055 <NA>
## YOB.Age.dff 0.0263896332 0 0.0263896332 <NA>
## Q118232.fctr 0.0263557469 0 0.0263557469 <NA>
## Gender.fctr 0.0260785749 0 0.0260785749 <NA>
## Q105655.fctr 0.0254502518 0 0.0254502518 <NA>
## Q99480.fctr 0.0241968063 0 0.0241968063 <NA>
## Q123464.fctr 0.0232487747 0 0.0232487747 <NA>
## Q120650.fctr 0.0228127973 0 0.0228127973 <NA>
## Q122120.fctr 0.0226963845 0 0.0226963845 <NA>
## Q107869.fctr 0.0218682393 0 0.0218682393 <NA>
## Q120014.fctr 0.0202731591 0 0.0202731591 <NA>
## Q102289.fctr 0.0192468615 0 0.0192468615 <NA>
## Income.fctr 0.0179840418 0 0.0179840418 <NA>
## Q122770.fctr 0.0174735493 0 0.0174735493 <NA>
## Q111580.fctr 0.0170269417 0 0.0170269417 <NA>
## Q116601.fctr 0.0159184435 0 0.0159184435 <NA>
## Q117186.fctr 0.0158641235 0 0.0158641235 <NA>
## Q106993.fctr 0.0151551332 0 0.0151551332 <NA>
## Q112270.fctr 0.0147892685 0 0.0147892685 <NA>
## Q101162.fctr 0.0139326027 0 0.0139326027 <NA>
## Q108856.fctr 0.0128750759 0 0.0128750759 <NA>
## Q117193.fctr 0.0114974111 0 0.0114974111 <NA>
## Q116441.fctr 0.0093463969 0 0.0093463969 <NA>
## Q119851.fctr 0.0089549525 0 0.0089549525 <NA>
## Q111848.fctr 0.0085442819 0 0.0085442819 <NA>
## Q98578.fctr 0.0067135887 0 0.0067135887 <NA>
## Q118892.fctr 0.0063006467 0 0.0063006467 <NA>
## Q114386.fctr 0.0057240993 0 0.0057240993 <NA>
## Q120978.fctr 0.0055115231 0 0.0055115231 <NA>
## Q112512.fctr 0.0053167658 0 0.0053167658 <NA>
## Q102674.fctr 0.0050627208 0 0.0050627208 <NA>
## Q96024.fctr 0.0040534729 0 0.0040534729 <NA>
## Q108950.fctr 0.0039412433 0 0.0039412433 <NA>
## Q115610.fctr 0.0037395055 0 0.0037395055 <NA>
## YOB.Age.fctr 0.0031160191 0 0.0031160191 <NA>
## Q112478.fctr 0.0028932765 0 0.0028932765 <NA>
## Q116197.fctr 0.0026906806 0 0.0026906806 <NA>
## Q124742.fctr 0.0025316261 0 0.0025316261 <NA>
## Q106389.fctr 0.0020182255 0 0.0020182255 <NA>
## Edn.fctr 0.0013569584 0 0.0013569584 <NA>
## Q118117.fctr 0.0006385446 0 0.0006385446 <NA>
## Q100562.fctr 0.0001743827 0 0.0001743827 <NA>
## Q107491.fctr -0.0001103153 0 0.0001103153 <NA>
## Q116448.fctr -0.0023584430 0 0.0023584430 <NA>
## Q108754.fctr -0.0027742157 0 0.0027742157 <NA>
## Q116953.fctr -0.0029373549 0 0.0029373549 <NA>
## Q115602.fctr -0.0031238519 0 0.0031238519 <NA>
## Q118233.fctr -0.0033273008 0 0.0033273008 <NA>
## Q120012.fctr -0.0039513241 0 0.0039513241 <NA>
## Q118237.fctr -0.0043335513 0 0.0043335513 <NA>
## Q99581.fctr -0.0046486977 0 0.0046486977 <NA>
## .rnorm -0.0048723001 0 0.0048723001 <NA>
## Q120194.fctr -0.0057263432 0 0.0057263432 <NA>
## Q115777.fctr -0.0059804934 0 0.0059804934 <NA>
## Q106997.fctr -0.0063914109 0 0.0063914109 <NA>
## Q100680.fctr -0.0072431931 0 0.0072431931 <NA>
## Q113584.fctr -0.0076436688 0 0.0076436688 <NA>
## Q108343.fctr -0.0079333386 0 0.0079333386 <NA>
## Q121700.fctr -0.0087942115 0 0.0087942115 <NA>
## Q105840.fctr -0.0088034036 0 0.0088034036 <NA>
## Q120379.fctr -0.0089842116 0 0.0089842116 <NA>
## Q103293.fctr -0.0090167793 0 0.0090167793 <NA>
## Q124122.fctr -0.0099503887 0 0.0099503887 <NA>
## Q109367.fctr -0.0100116070 0 0.0100116070 <NA>
## Q113992.fctr -0.0100378101 0 0.0100378101 <NA>
## Q121699.fctr -0.0121369662 0 0.0121369662 <NA>
## Q121011.fctr -0.0122186222 0 0.0122186222 <NA>
## Q114748.fctr -0.0128363203 0 0.0128363203 <NA>
## Q106042.fctr -0.0135167901 0 0.0135167901 <NA>
## Q111220.fctr -0.0145971279 0 0.0145971279 <NA>
## Q114517.fctr -0.0148538356 0 0.0148538356 <NA>
## YOB -0.0169432580 1 0.0169432580 <NA>
## Q102687.fctr -0.0169904229 0 0.0169904229 <NA>
## Q102906.fctr -0.0173704239 0 0.0173704239 <NA>
## Q98078.fctr -0.0177772661 0 0.0177772661 <NA>
## Q115390.fctr -0.0196547694 0 0.0196547694 <NA>
## Q102089.fctr -0.0200451075 0 0.0200451075 <NA>
## Q100010.fctr -0.0208031518 0 0.0208031518 <NA>
## Q99982.fctr -0.0208604939 0 0.0208604939 <NA>
## Q113583.fctr -0.0211296876 0 0.0211296876 <NA>
## Q108342.fctr -0.0211946324 0 0.0211946324 <NA>
## Q104996.fctr -0.0218776356 0 0.0218776356 <NA>
## Q119650.fctr -0.0222628005 0 0.0222628005 <NA>
## Q100689.fctr -0.0263249102 0 0.0263249102 <NA>
## Q108617.fctr -0.0285334447 0 0.0285334447 <NA>
## Q115195.fctr -0.0295831061 0 0.0295831061 <NA>
## Q99716.fctr -0.0333178411 0 0.0333178411 <NA>
## Q101163.fctr -0.0349739760 0 0.0349739760 <NA>
## Q98059.fctr -0.0354482758 0 0.0354482758 <NA>
## Q114961.fctr -0.0396043459 0 0.0396043459 <NA>
## .clusterid -0.0640119129 1 0.0640119129 <NA>
## .clusterid.fctr -0.0640119129 0 0.0640119129 Q113181.fctr
## Hhold.fctr -0.0644984804 0 0.0644984804 <NA>
## Q109244.fctr NA 0 NA <NA>
## freqRatio percentUnique zeroVar nzv is.cor.y.abs.low
## Q115611.fctr 1.346501 0.12200081 FALSE FALSE FALSE
## Q113181.fctr 1.207806 0.12200081 FALSE FALSE FALSE
## Q98197.fctr 1.293258 0.12200081 FALSE FALSE FALSE
## Q116881.fctr 2.244592 0.12200081 FALSE FALSE FALSE
## Q108855.fctr 1.511876 0.12200081 FALSE FALSE FALSE
## Q106272.fctr 2.712785 0.12200081 FALSE FALSE FALSE
## Q122771.fctr 3.656388 0.12200081 FALSE FALSE FALSE
## Q123621.fctr 1.144186 0.12200081 FALSE FALSE FALSE
## Q106388.fctr 2.478261 0.12200081 FALSE FALSE FALSE
## Q110740.fctr 1.491409 0.12200081 FALSE FALSE FALSE
## USER_ID 1.000000 100.00000000 FALSE FALSE FALSE
## .pos 1.000000 100.00000000 FALSE FALSE FALSE
## Q122769.fctr 1.693260 0.12200081 FALSE FALSE FALSE
## Q120472.fctr 2.803119 0.12200081 FALSE FALSE FALSE
## Q101596.fctr 1.737877 0.12200081 FALSE FALSE FALSE
## Q119334.fctr 1.125395 0.12200081 FALSE FALSE FALSE
## Q114152.fctr 2.270531 0.12200081 FALSE FALSE FALSE
## Q98869.fctr 3.614191 0.12200081 FALSE FALSE FALSE
## Q115899.fctr 1.448234 0.12200081 FALSE FALSE FALSE
## Q116797.fctr 2.093023 0.12200081 FALSE FALSE FALSE
## YOB.Age.dff 1.021687 0.73200488 FALSE FALSE FALSE
## Q118232.fctr 1.307600 0.12200081 FALSE FALSE FALSE
## Gender.fctr 2.405063 0.12200081 FALSE FALSE FALSE
## Q105655.fctr 1.274947 0.12200081 FALSE FALSE FALSE
## Q99480.fctr 4.095588 0.12200081 FALSE FALSE FALSE
## Q123464.fctr 3.190731 0.12200081 FALSE FALSE FALSE
## Q120650.fctr 3.544379 0.12200081 FALSE FALSE FALSE
## Q122120.fctr 3.098563 0.12200081 FALSE FALSE FALSE
## Q107869.fctr 1.293617 0.12200081 FALSE FALSE FALSE
## Q120014.fctr 1.623324 0.12200081 FALSE FALSE FALSE
## Q102289.fctr 2.286846 0.12200081 FALSE FALSE FALSE
## Income.fctr 1.026596 0.28466856 FALSE FALSE FALSE
## Q122770.fctr 1.407720 0.12200081 FALSE FALSE FALSE
## Q111580.fctr 1.934936 0.12200081 FALSE FALSE FALSE
## Q116601.fctr 3.948235 0.12200081 FALSE FALSE FALSE
## Q117186.fctr 1.761702 0.12200081 FALSE FALSE FALSE
## Q106993.fctr 4.903581 0.12200081 FALSE FALSE FALSE
## Q112270.fctr 1.134313 0.12200081 FALSE FALSE FALSE
## Q101162.fctr 1.556382 0.12200081 FALSE FALSE FALSE
## Q108856.fctr 2.251156 0.12200081 FALSE FALSE FALSE
## Q117193.fctr 1.346618 0.12200081 FALSE FALSE FALSE
## Q116441.fctr 1.638601 0.12200081 FALSE FALSE FALSE
## Q119851.fctr 1.575758 0.12200081 FALSE FALSE FALSE
## Q111848.fctr 1.402247 0.12200081 FALSE FALSE FALSE
## Q98578.fctr 1.717158 0.12200081 FALSE FALSE FALSE
## Q118892.fctr 1.411356 0.12200081 FALSE FALSE FALSE
## Q114386.fctr 1.426366 0.12200081 FALSE FALSE FALSE
## Q120978.fctr 1.264000 0.12200081 FALSE FALSE FALSE
## Q112512.fctr 4.175743 0.12200081 FALSE FALSE FALSE
## Q102674.fctr 1.849030 0.12200081 FALSE FALSE FALSE
## Q96024.fctr 1.683444 0.12200081 FALSE FALSE TRUE
## Q108950.fctr 2.087366 0.12200081 FALSE FALSE TRUE
## Q115610.fctr 3.966825 0.12200081 FALSE FALSE TRUE
## YOB.Age.fctr 1.180000 0.36600244 FALSE FALSE TRUE
## Q112478.fctr 1.459880 0.12200081 FALSE FALSE TRUE
## Q116197.fctr 2.031484 0.12200081 FALSE FALSE TRUE
## Q124742.fctr 1.322468 0.12200081 FALSE FALSE TRUE
## Q106389.fctr 1.086957 0.12200081 FALSE FALSE TRUE
## Edn.fctr 1.694524 0.32533550 FALSE FALSE TRUE
## Q118117.fctr 1.402074 0.12200081 FALSE FALSE TRUE
## Q100562.fctr 4.329082 0.12200081 FALSE FALSE TRUE
## Q107491.fctr 6.288591 0.12200081 FALSE FALSE TRUE
## Q116448.fctr 1.352326 0.12200081 FALSE FALSE TRUE
## Q108754.fctr 2.045897 0.12200081 FALSE FALSE TRUE
## Q116953.fctr 1.978788 0.12200081 FALSE FALSE TRUE
## Q115602.fctr 3.864608 0.12200081 FALSE FALSE TRUE
## Q118233.fctr 2.654676 0.12200081 FALSE FALSE TRUE
## Q120012.fctr 1.344262 0.12200081 FALSE FALSE TRUE
## Q118237.fctr 1.429419 0.12200081 FALSE FALSE TRUE
## Q99581.fctr 4.989011 0.12200081 FALSE FALSE TRUE
## .rnorm 1.000000 100.00000000 FALSE FALSE FALSE
## Q120194.fctr 1.317536 0.12200081 FALSE FALSE FALSE
## Q115777.fctr 1.387173 0.12200081 FALSE FALSE FALSE
## Q106997.fctr 1.187117 0.12200081 FALSE FALSE FALSE
## Q100680.fctr 1.250542 0.12200081 FALSE FALSE FALSE
## Q113584.fctr 1.008824 0.12200081 FALSE FALSE FALSE
## Q108343.fctr 1.565774 0.12200081 FALSE FALSE FALSE
## Q121700.fctr 3.968468 0.12200081 FALSE FALSE FALSE
## Q105840.fctr 1.486260 0.12200081 FALSE FALSE FALSE
## Q120379.fctr 1.447596 0.12200081 FALSE FALSE FALSE
## Q103293.fctr 1.252910 0.12200081 FALSE FALSE FALSE
## Q124122.fctr 1.187500 0.12200081 FALSE FALSE FALSE
## Q109367.fctr 1.460805 0.12200081 FALSE FALSE FALSE
## Q113992.fctr 2.253086 0.12200081 FALSE FALSE FALSE
## Q121699.fctr 2.600355 0.12200081 FALSE FALSE FALSE
## Q121011.fctr 1.158969 0.12200081 FALSE FALSE FALSE
## Q114748.fctr 1.344482 0.12200081 FALSE FALSE FALSE
## Q106042.fctr 1.319690 0.12200081 FALSE FALSE FALSE
## Q111220.fctr 3.014898 0.12200081 FALSE FALSE FALSE
## Q114517.fctr 2.182796 0.12200081 FALSE FALSE FALSE
## YOB 1.105769 2.92801952 FALSE FALSE FALSE
## Q102687.fctr 1.004803 0.12200081 FALSE FALSE FALSE
## Q102906.fctr 1.950213 0.12200081 FALSE FALSE FALSE
## Q98078.fctr 1.590206 0.12200081 FALSE FALSE FALSE
## Q115390.fctr 1.460576 0.12200081 FALSE FALSE FALSE
## Q102089.fctr 2.381260 0.12200081 FALSE FALSE FALSE
## Q100010.fctr 3.962529 0.12200081 FALSE FALSE FALSE
## Q99982.fctr 1.107143 0.12200081 FALSE FALSE FALSE
## Q113583.fctr 1.881690 0.12200081 FALSE FALSE FALSE
## Q108342.fctr 2.426563 0.12200081 FALSE FALSE FALSE
## Q104996.fctr 1.032350 0.12200081 FALSE FALSE FALSE
## Q119650.fctr 3.108830 0.12200081 FALSE FALSE FALSE
## Q100689.fctr 1.440137 0.12200081 FALSE FALSE FALSE
## Q108617.fctr 7.888446 0.12200081 FALSE FALSE FALSE
## Q115195.fctr 1.713147 0.12200081 FALSE FALSE FALSE
## Q99716.fctr 4.852332 0.12200081 FALSE FALSE FALSE
## Q101163.fctr 1.437576 0.12200081 FALSE FALSE FALSE
## Q98059.fctr 5.379888 0.12200081 FALSE FALSE FALSE
## Q114961.fctr 1.029000 0.12200081 FALSE FALSE FALSE
## .clusterid 1.300000 0.12200081 FALSE FALSE FALSE
## .clusterid.fctr 1.300000 0.12200081 FALSE FALSE FALSE
## Hhold.fctr 1.209330 0.28466856 FALSE FALSE FALSE
## Q109244.fctr 0.000000 0.04066694 TRUE TRUE NA
## Warning in myplot_scatter(plt_feats_df, "percentUnique", "freqRatio",
## colorcol_name = "nzv", : converting nzv to class:factor
## Warning: Removed 3 rows containing missing values (geom_point).
## Warning: Removed 3 rows containing missing values (geom_point).
## Warning: Removed 3 rows containing missing values (geom_point).
## cor.y exclude.as.feat cor.y.abs cor.high.X freqRatio
## Q109244.fctr NA 0 NA <NA> 0
## percentUnique zeroVar nzv is.cor.y.abs.low
## Q109244.fctr 0.04066694 TRUE TRUE NA
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## [1] "numeric data missing in : "
## YOB Party.fctr
## 128 622
## [1] "numeric data w/ 0s in : "
## YOB.Age.dff
## 136
## [1] "numeric data w/ Infs in : "
## named integer(0)
## [1] "numeric data w/ NaNs in : "
## named integer(0)
## [1] "string data missing in : "
## Gender Income HouseholdStatus EducationLevel
## 46 445 177 410
## Party Q124742 Q124122 Q123464
## NA 1438 823 708
## Q123621 Q122769 Q122770 Q122771
## 778 644 594 587
## Q122120 Q121699 Q121700 Q120978
## 585 547 563 599
## Q121011 Q120379 Q120650 Q120472
## 571 607 655 649
## Q120194 Q120012 Q120014 Q119334
## 654 591 641 568
## Q119851 Q119650 Q118892 Q118117
## 540 578 486 479
## Q118232 Q118233 Q118237 Q117186
## 701 554 539 648
## Q117193 Q116797 Q116881 Q116953
## 655 590 635 616
## Q116601 Q116441 Q116448 Q116197
## 534 541 560 551
## Q115602 Q115777 Q115610 Q115611
## 539 578 537 487
## Q115899 Q115390 Q114961 Q114748
## 573 619 538 447
## Q115195 Q114517 Q114386 Q113992
## 525 481 521 447
## Q114152 Q113583 Q113584 Q113181
## 537 514 512 453
## Q112478 Q112512 Q112270 Q111848
## 494 460 521 398
## Q111580 Q111220 Q110740 Q109367
## 474 379 357 168
## Q108950 Q109244 Q108855 Q108617
## 204 0 438 288
## Q108856 Q108754 Q108342 Q108343
## 436 338 341 333
## Q107869 Q107491 Q106993 Q106997
## 389 366 389 396
## Q106272 Q106388 Q106389 Q106042
## 426 476 495 451
## Q105840 Q105655 Q104996 Q103293
## 487 393 400 431
## Q102906 Q102674 Q102687 Q102289
## 493 511 475 484
## Q102089 Q101162 Q101163 Q101596
## 462 498 572 477
## Q100689 Q100680 Q100562 Q99982
## 414 497 487 514
## Q100010 Q99716 Q99581 Q99480
## 445 500 466 478
## Q98869 Q98578 Q98059 Q98078
## 564 542 450 569
## Q98197 Q96024 .lcn
## 528 550 622
## [1] "glb_feats_df:"
## [1] 113 12
## id exclude.as.feat rsp_var
## Party.fctr Party.fctr TRUE TRUE
## id cor.y exclude.as.feat cor.y.abs cor.high.X
## USER_ID USER_ID 0.04512535 TRUE 0.04512535 <NA>
## Party.fctr Party.fctr NA TRUE NA <NA>
## freqRatio percentUnique zeroVar nzv is.cor.y.abs.low
## USER_ID 1 100 FALSE FALSE FALSE
## Party.fctr NA NA NA NA NA
## interaction.feat shapiro.test.p.value rsp_var_raw id_var
## USER_ID <NA> NA FALSE TRUE
## Party.fctr <NA> NA NA NA
## rsp_var
## USER_ID NA
## Party.fctr TRUE
## [1] "glb_feats_df vs. glbObsAll: "
## character(0)
## [1] "glbObsAll vs. glb_feats_df: "
## character(0)
## label step_major step_minor label_minor bgn end
## 15 select.features 7 0 0 297.456 302.156
## 16 fit.models 8 0 0 302.157 NA
## elapsed
## 15 4.7
## 16 NA
8.0: fit modelsfit.models_0_chunk_df <- myadd_chunk(NULL, "fit.models_0_bgn", label.minor = "setup")
## label step_major step_minor label_minor bgn end elapsed
## 1 fit.models_0_bgn 1 0 setup 303.198 NA NA
# load(paste0(glbOut$pfx, "dsk.RData"))
glbgetModelSelectFormula <- function() {
model_evl_terms <- c(NULL)
# min.aic.fit might not be avl
lclMdlEvlCriteria <-
glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)]
for (metric in lclMdlEvlCriteria)
model_evl_terms <- c(model_evl_terms,
ifelse(length(grep("max", metric)) > 0, "-", "+"), metric)
if (glb_is_classification && glb_is_binomial)
model_evl_terms <- c(model_evl_terms, "-", "opt.prob.threshold.OOB")
model_sel_frmla <- as.formula(paste(c("~ ", model_evl_terms), collapse = " "))
return(model_sel_frmla)
}
glbgetDisplayModelsDf <- function() {
dsp_models_cols <- c("id",
glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)],
grep("opt.", names(glb_models_df), fixed = TRUE, value = TRUE))
dsp_models_df <-
#orderBy(glbgetModelSelectFormula(), glb_models_df)[, c("id", glbMdlMetricsEval)]
orderBy(glbgetModelSelectFormula(), glb_models_df)[, dsp_models_cols]
nCvMdl <- sapply(glb_models_lst, function(mdl) nrow(mdl$results))
nParams <- sapply(glb_models_lst, function(mdl) ifelse(mdl$method == "custom", 0,
nrow(subset(modelLookup(mdl$method), parameter != "parameter"))))
# nCvMdl <- nCvMdl[names(nCvMdl) != "avNNet"]
# nParams <- nParams[names(nParams) != "avNNet"]
if (length(cvMdlProblems <- nCvMdl[nCvMdl <= nParams]) > 0) {
print("Cross Validation issues:")
warning("Cross Validation issues:")
print(cvMdlProblems)
}
pltMdls <- setdiff(names(nCvMdl), names(cvMdlProblems))
pltMdls <- setdiff(pltMdls, names(nParams[nParams == 0]))
# length(pltMdls) == 21
png(paste0(glbOut$pfx, "bestTune.png"), width = 480 * 2, height = 480 * 4)
grid.newpage()
pushViewport(viewport(layout = grid.layout(ceiling(length(pltMdls) / 2.0), 2)))
pltIx <- 1
for (mdlId in pltMdls) {
print(ggplot(glb_models_lst[[mdlId]], highBestTune = TRUE) + labs(title = mdlId),
vp = viewport(layout.pos.row = ceiling(pltIx / 2.0),
layout.pos.col = ((pltIx - 1) %% 2) + 1))
pltIx <- pltIx + 1
}
dev.off()
if (all(row.names(dsp_models_df) != dsp_models_df$id))
row.names(dsp_models_df) <- dsp_models_df$id
return(dsp_models_df)
}
#glbgetDisplayModelsDf()
glb_get_predictions <- function(df, mdl_id, rsp_var, prob_threshold_def=NULL, verbose=FALSE) {
mdl <- glb_models_lst[[mdl_id]]
clmnNames <- mygetPredictIds(rsp_var, mdl_id)
predct_var_name <- clmnNames$value
predct_prob_var_name <- clmnNames$prob
predct_accurate_var_name <- clmnNames$is.acc
predct_error_var_name <- clmnNames$err
predct_erabs_var_name <- clmnNames$err.abs
if (glb_is_regression) {
df[, predct_var_name] <- predict(mdl, newdata=df, type="raw")
if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_var_name) +
facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
stat_smooth(method="glm"))
df[, predct_error_var_name] <- df[, predct_var_name] - df[, glb_rsp_var]
if (verbose) print(myplot_scatter(df, predct_var_name, predct_error_var_name) +
#facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
stat_smooth(method="auto"))
if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_error_var_name) +
#facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
stat_smooth(method="glm"))
df[, predct_erabs_var_name] <- abs(df[, predct_error_var_name])
if (verbose) print(head(orderBy(reformulate(c("-", predct_erabs_var_name)), df)))
df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])
}
if (glb_is_classification && glb_is_binomial) {
prob_threshold <- glb_models_df[glb_models_df$id == mdl_id,
"opt.prob.threshold.OOB"]
if (is.null(prob_threshold) || is.na(prob_threshold)) {
warning("Using default probability threshold: ", prob_threshold_def)
if (is.null(prob_threshold <- prob_threshold_def))
stop("Default probability threshold is NULL")
}
df[, predct_prob_var_name] <- predict(mdl, newdata = df, type = "prob")[, 2]
df[, predct_var_name] <-
factor(levels(df[, glb_rsp_var])[
(df[, predct_prob_var_name] >=
prob_threshold) * 1 + 1], levels(df[, glb_rsp_var]))
# if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_var_name) +
# facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
# stat_smooth(method="glm"))
df[, predct_error_var_name] <- df[, predct_var_name] != df[, glb_rsp_var]
# if (verbose) print(myplot_scatter(df, predct_var_name, predct_error_var_name) +
# #facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
# stat_smooth(method="auto"))
# if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_error_var_name) +
# #facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
# stat_smooth(method="glm"))
# if prediction is a TP (true +ve), measure distance from 1.0
tp <- which((df[, predct_var_name] == df[, glb_rsp_var]) &
(df[, predct_var_name] == levels(df[, glb_rsp_var])[2]))
df[tp, predct_erabs_var_name] <- abs(1 - df[tp, predct_prob_var_name])
#rowIx <- which.max(df[tp, predct_erabs_var_name]); df[tp, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
# if prediction is a TN (true -ve), measure distance from 0.0
tn <- which((df[, predct_var_name] == df[, glb_rsp_var]) &
(df[, predct_var_name] == levels(df[, glb_rsp_var])[1]))
df[tn, predct_erabs_var_name] <- abs(0 - df[tn, predct_prob_var_name])
#rowIx <- which.max(df[tn, predct_erabs_var_name]); df[tn, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
# if prediction is a FP (flse +ve), measure distance from 0.0
fp <- which((df[, predct_var_name] != df[, glb_rsp_var]) &
(df[, predct_var_name] == levels(df[, glb_rsp_var])[2]))
df[fp, predct_erabs_var_name] <- abs(0 - df[fp, predct_prob_var_name])
#rowIx <- which.max(df[fp, predct_erabs_var_name]); df[fp, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
# if prediction is a FN (flse -ve), measure distance from 1.0
fn <- which((df[, predct_var_name] != df[, glb_rsp_var]) &
(df[, predct_var_name] == levels(df[, glb_rsp_var])[1]))
df[fn, predct_erabs_var_name] <- abs(1 - df[fn, predct_prob_var_name])
#rowIx <- which.max(df[fn, predct_erabs_var_name]); df[fn, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
if (verbose) print(head(orderBy(reformulate(c("-", predct_erabs_var_name)), df)))
df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])
}
if (glb_is_classification && !glb_is_binomial) {
df[, predct_var_name] <- predict(mdl, newdata = df, type = "raw")
probCls <- predict(mdl, newdata = df, type = "prob")
df[, predct_prob_var_name] <- NA
for (cls in names(probCls)) {
mask <- (df[, predct_var_name] == cls)
df[mask, predct_prob_var_name] <- probCls[mask, cls]
}
if (verbose) print(myplot_histogram(df, predct_prob_var_name,
fill_col_name = predct_var_name))
if (verbose) print(myplot_histogram(df, predct_prob_var_name,
facet_frmla = paste0("~", glb_rsp_var)))
df[, predct_error_var_name] <- df[, predct_var_name] != df[, glb_rsp_var]
# if prediction is erroneous, measure predicted class prob from actual class prob
df[, predct_erabs_var_name] <- 0
for (cls in names(probCls)) {
mask <- (df[, glb_rsp_var] == cls) & (df[, predct_error_var_name])
df[mask, predct_erabs_var_name] <- probCls[mask, cls]
}
df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])
}
return(df)
}
if (glb_is_classification && glb_is_binomial &&
(length(unique(glbObsFit[, glb_rsp_var])) < 2))
stop("glbObsFit$", glb_rsp_var, ": contains less than 2 unique values: ",
paste0(unique(glbObsFit[, glb_rsp_var]), collapse=", "))
max_cor_y_x_vars <- orderBy(~ -cor.y.abs,
subset(glb_feats_df, (exclude.as.feat == 0) & !nzv & !is.cor.y.abs.low &
is.na(cor.high.X)))[1:2, "id"]
max_cor_y_x_vars <- max_cor_y_x_vars[!is.na(max_cor_y_x_vars)]
if (length(max_cor_y_x_vars) < 2)
max_cor_y_x_vars <- union(max_cor_y_x_vars, ".pos")
if (!is.null(glb_Baseline_mdl_var)) {
if ((max_cor_y_x_vars[1] != glb_Baseline_mdl_var) &
(glb_feats_df[glb_feats_df$id == max_cor_y_x_vars[1], "cor.y.abs"] >
glb_feats_df[glb_feats_df$id == glb_Baseline_mdl_var, "cor.y.abs"]))
stop(max_cor_y_x_vars[1], " has a higher correlation with ", glb_rsp_var,
" than the Baseline var: ", glb_Baseline_mdl_var)
}
glb_model_type <- ifelse(glb_is_regression, "regression", "classification")
# Model specs
# c("id.prefix", "method", "type",
# # trainControl params
# "preProc.method", "cv.n.folds", "cv.n.repeats", "summary.fn",
# # train params
# "metric", "metric.maximize", "tune.df")
# Baseline
if (!is.null(glb_Baseline_mdl_var)) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Baseline"), major.inc = FALSE,
label.minor = "mybaseln_classfr")
ret_lst <- myfit_mdl(mdl_id="Baseline",
model_method="mybaseln_classfr",
indepVar=glb_Baseline_mdl_var,
rsp_var=glb_rsp_var,
fit_df=glbObsFit, OOB_df=glbObsOOB)
}
# Most Frequent Outcome "MFO" model: mean(y) for regression
# Not using caret's nullModel since model stats not avl
# Cannot use rpart for multinomial classification since it predicts non-MFO
if (glb_is_classification) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "MFO"), major.inc = FALSE,
label.minor = "myMFO_classfr")
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "MFO", type = glb_model_type, trainControl.method = "none",
train.method = ifelse(glb_is_regression, "lm", "myMFO_classfr"))),
indepVar = ".rnorm", rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
# "random" model - only for classification;
# none needed for regression since it is same as MFO
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Random"), major.inc = FALSE,
label.minor = "myrandom_classfr")
#stop(here"); glb2Sav(); all.equal(glb_models_df, sav_models_df)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Random", type = glb_model_type, trainControl.method = "none",
train.method = "myrandom_classfr")),
indepVar = ".rnorm", rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
## label step_major step_minor label_minor bgn end
## 1 fit.models_0_bgn 1 0 setup 303.198 303.234
## 2 fit.models_0_MFO 1 1 myMFO_classfr 303.234 NA
## elapsed
## 1 0.036
## 2 NA
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: MFO###myMFO_classfr"
## [1] " indepVar: .rnorm"
## [1] "myfit_mdl: setup complete: 0.445000 secs"
## Fitting parameter = none on full training set
## [1] "in MFO.Classifier$fit"
## [1] "unique.vals:"
## [1] D R
## Levels: D R
## [1] "unique.prob:"
## y
## R D
## 0.577823 0.422177
## [1] "MFO.val:"
## [1] "R"
## [1] "myfit_mdl: train complete: 1.033000 secs"
## parameter
## 1 none
## Length Class Mode
## unique.vals 2 factor numeric
## unique.prob 2 -none- numeric
## MFO.val 1 -none- character
## x.names 1 -none- character
## xNames 1 -none- character
## problemType 1 -none- character
## tuneValue 1 data.frame list
## obsLevels 2 -none- character
## Warning in if (mdl_specs_lst[["train.method"]] == "glm")
## mydisplayOutliers(mdl, : the condition has length > 1 and only the first
## element will be used
## [1] "myfit_mdl: train diagnostics complete: 1.037000 secs"
## Loading required namespace: pROC
## [1] "entr MFO.Classifier$predict"
## [1] "exit MFO.Classifier$predict"
## Loading required package: ROCR
## Loading required package: gplots
##
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
##
## lowess
## [1] "in MFO.Classifier$prob"
## D R
## 1 0.577823 0.422177
## 2 0.577823 0.422177
## 3 0.577823 0.422177
## 4 0.577823 0.422177
## 5 0.577823 0.422177
## 6 0.577823 0.422177
## Prediction
## Reference D R
## D 0 830
## R 0 1136
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.778230e-01 0.000000e+00 5.556337e-01 5.997798e-01 5.778230e-01
## AccuracyPValue McnemarPValue
## 5.095795e-01 4.407827e-182
## [1] "entr MFO.Classifier$predict"
## [1] "exit MFO.Classifier$predict"
## [1] "in MFO.Classifier$prob"
## D R
## 1 0.577823 0.422177
## 2 0.577823 0.422177
## 3 0.577823 0.422177
## 4 0.577823 0.422177
## 5 0.577823 0.422177
## 6 0.577823 0.422177
## Prediction
## Reference D R
## D 0 208
## R 0 285
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.780933e-01 0.000000e+00 5.331249e-01 6.221196e-01 5.780933e-01
## AccuracyPValue McnemarPValue
## 5.191262e-01 1.022216e-46
## [1] "myfit_mdl: predict complete: 7.162000 secs"
## id feats max.nTuningRuns min.elapsedtime.everything
## 1 MFO###myMFO_classfr .rnorm 0 0.58
## min.elapsedtime.final max.AUCpROC.fit max.Sens.fit max.Spec.fit
## 1 0.003 0.5 0 1
## max.AUCROCR.fit opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.5 0.4 0.7324307 0.577823
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.5556337 0.5997798 0
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.5 0 1 0.5
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0.4 0.7326478 0.5780933
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5331249 0.6221196 0
## [1] "in MFO.Classifier$prob"
## D R
## 1 0.577823 0.422177
## 2 0.577823 0.422177
## 3 0.577823 0.422177
## 4 0.577823 0.422177
## 5 0.577823 0.422177
## 6 0.577823 0.422177
## [1] "myfit_mdl: exit: 7.214000 secs"
## label step_major step_minor label_minor bgn
## 2 fit.models_0_MFO 1 1 myMFO_classfr 303.234
## 3 fit.models_0_Random 1 2 myrandom_classfr 310.455
## end elapsed
## 2 310.454 7.221
## 3 NA NA
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: Random###myrandom_classfr"
## [1] " indepVar: .rnorm"
## [1] "myfit_mdl: setup complete: 0.423000 secs"
## Fitting parameter = none on full training set
## [1] "myfit_mdl: train complete: 0.824000 secs"
## parameter
## 1 none
## Length Class Mode
## unique.vals 2 factor numeric
## unique.prob 2 table numeric
## xNames 1 -none- character
## problemType 1 -none- character
## tuneValue 1 data.frame list
## obsLevels 2 -none- character
## Warning in if (mdl_specs_lst[["train.method"]] == "glm")
## mydisplayOutliers(mdl, : the condition has length > 1 and only the first
## element will be used
## [1] "myfit_mdl: train diagnostics complete: 0.827000 secs"
## [1] "in Random.Classifier$prob"
## Prediction
## Reference D R
## D 0 830
## R 0 1136
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.778230e-01 0.000000e+00 5.556337e-01 5.997798e-01 5.778230e-01
## AccuracyPValue McnemarPValue
## 5.095795e-01 4.407827e-182
## [1] "in Random.Classifier$prob"
## Prediction
## Reference D R
## D 0 208
## R 0 285
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.780933e-01 0.000000e+00 5.331249e-01 6.221196e-01 5.780933e-01
## AccuracyPValue McnemarPValue
## 5.191262e-01 1.022216e-46
## [1] "myfit_mdl: predict complete: 7.248000 secs"
## id feats max.nTuningRuns
## 1 Random###myrandom_classfr .rnorm 0
## min.elapsedtime.everything min.elapsedtime.final max.AUCpROC.fit
## 1 0.397 0.002 0.5127577
## max.Sens.fit max.Spec.fit max.AUCROCR.fit opt.prob.threshold.fit
## 1 0.4313253 0.5941901 0.4952189 0.4
## max.f.score.fit max.Accuracy.fit max.AccuracyLower.fit
## 1 0.7324307 0.577823 0.5556337
## max.AccuracyUpper.fit max.Kappa.fit max.AUCpROC.OOB max.Sens.OOB
## 1 0.5997798 0 0.4988023 0.4326923
## max.Spec.OOB max.AUCROCR.OOB opt.prob.threshold.OOB max.f.score.OOB
## 1 0.5649123 0.5142038 0.4 0.7326478
## max.Accuracy.OOB max.AccuracyLower.OOB max.AccuracyUpper.OOB
## 1 0.5780933 0.5331249 0.6221196
## max.Kappa.OOB
## 1 0
## [1] "in Random.Classifier$prob"
## [1] "myfit_mdl: exit: 8.058000 secs"
# Max.cor.Y
# Check impact of cv
# rpart is not a good candidate since caret does not optimize cp (only tuning parameter of rpart) well
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Max.cor.Y.rcv.*X*"), major.inc = FALSE,
label.minor = "glmnet")
## label step_major step_minor label_minor
## 3 fit.models_0_Random 1 2 myrandom_classfr
## 4 fit.models_0_Max.cor.Y.rcv.*X* 1 3 glmnet
## bgn end elapsed
## 3 310.455 318.526 8.072
## 4 318.527 NA NA
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.rcv.1X1", type = glb_model_type, trainControl.method = "none",
train.method = "glmnet")),
indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: Max.cor.Y.rcv.1X1###glmnet"
## [1] " indepVar: Q115611.fctr,Q113181.fctr"
## [1] "myfit_mdl: setup complete: 0.684000 secs"
## Loading required package: glmnet
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
##
## expand
## Loaded glmnet 2.0-5
## Fitting alpha = 0.1, lambda = 0.00155 on full training set
## [1] "myfit_mdl: train complete: 1.498000 secs"
## alpha lambda
## 1 0.1 0.001547307
## Length Class Mode
## a0 47 -none- numeric
## beta 188 dgCMatrix S4
## df 47 -none- numeric
## dim 2 -none- numeric
## lambda 47 -none- numeric
## dev.ratio 47 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 4 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) Q113181.fctrNo Q113181.fctrYes Q115611.fctrNo
## 0.2769638 -0.2766773 0.3638715 -0.2172004
## Q115611.fctrYes
## 0.4047733
## [1] "max lambda < lambdaOpt:"
## [1] "Feats mismatch between coefs_left & rght:"
## [1] "(Intercept)" "Q113181.fctrNo" "Q113181.fctrYes" "Q115611.fctrNo"
## [5] "Q115611.fctrYes"
## [1] "myfit_mdl: train diagnostics complete: 1.606000 secs"
## Prediction
## Reference D R
## D 385 445
## R 304 832
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.190234e-01 2.008451e-01 5.971380e-01 6.405531e-01 5.778230e-01
## AccuracyPValue McnemarPValue
## 1.108701e-04 3.129297e-07
## Prediction
## Reference D R
## D 0 208
## R 0 285
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.780933e-01 0.000000e+00 5.331249e-01 6.221196e-01 5.780933e-01
## AccuracyPValue McnemarPValue
## 5.191262e-01 1.022216e-46
## [1] "myfit_mdl: predict complete: 7.307000 secs"
## id feats max.nTuningRuns
## 1 Max.cor.Y.rcv.1X1###glmnet Q115611.fctr,Q113181.fctr 0
## min.elapsedtime.everything min.elapsedtime.final max.AUCpROC.fit
## 1 0.807 0.029 0.5770809
## max.Sens.fit max.Spec.fit max.AUCROCR.fit opt.prob.threshold.fit
## 1 0.3566265 0.7975352 0.6231477 0.55
## max.f.score.fit max.Accuracy.fit max.AccuracyLower.fit
## 1 0.689598 0.6190234 0.597138
## max.AccuracyUpper.fit max.Kappa.fit max.AUCpROC.OOB max.Sens.OOB
## 1 0.6405531 0.2008451 0.533249 0.2980769
## max.Spec.OOB max.AUCROCR.OOB opt.prob.threshold.OOB max.f.score.OOB
## 1 0.7684211 0.5660003 0.4 0.7326478
## max.Accuracy.OOB max.AccuracyLower.OOB max.AccuracyUpper.OOB
## 1 0.5780933 0.5331249 0.6221196
## max.Kappa.OOB
## 1 0
## [1] "myfit_mdl: exit: 7.376000 secs"
if (glbMdlCheckRcv) {
# rcv_n_folds == 1 & rcv_n_repeats > 1 crashes
for (rcv_n_folds in seq(3, glb_rcv_n_folds + 2, 2))
for (rcv_n_repeats in seq(1, glb_rcv_n_repeats + 2, 2)) {
# Experiment specific code to avoid caret crash
# lcl_tune_models_df <- rbind(data.frame()
# ,data.frame(method = "glmnet", parameter = "alpha",
# vals = "0.100 0.325 0.550 0.775 1.000")
# ,data.frame(method = "glmnet", parameter = "lambda",
# vals = "9.342e-02")
# )
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
list(
id.prefix = paste0("Max.cor.Y.rcv.", rcv_n_folds, "X", rcv_n_repeats),
type = glb_model_type,
# tune.df = lcl_tune_models_df,
trainControl.method = "repeatedcv",
trainControl.number = rcv_n_folds,
trainControl.repeats = rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
train.method = "glmnet", train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize)),
indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
# Add parallel coordinates graph of glb_models_df[, glbMdlMetricsEval] to evaluate cv parameters
tmp_models_cols <- c("id", "max.nTuningRuns",
glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)],
grep("opt.", names(glb_models_df), fixed = TRUE, value = TRUE))
print(myplot_parcoord(obs_df = subset(glb_models_df,
grepl("Max.cor.Y.rcv.", id, fixed = TRUE),
select = -feats)[, tmp_models_cols],
id_var = "id"))
}
# Useful for stacking decisions
# fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
# paste0("fit.models_0_", "Max.cor.Y[rcv.1X1.cp.0|]"), major.inc = FALSE,
# label.minor = "rpart")
#
# ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
# id.prefix = "Max.cor.Y.rcv.1X1.cp.0", type = glb_model_type, trainControl.method = "none",
# train.method = "rpart",
# tune.df=data.frame(method="rpart", parameter="cp", min=0.0, max=0.0, by=0.1))),
# indepVar=max_cor_y_x_vars, rsp_var=glb_rsp_var,
# fit_df=glbObsFit, OOB_df=glbObsOOB)
#stop(here"); glb2Sav(); all.equal(glb_models_df, sav_models_df)
# if (glb_is_regression || glb_is_binomial) # For multinomials this model will be run next by default
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y",
type = glb_model_type, trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds,
trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "rpart")),
indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: Max.cor.Y##rcv#rpart"
## [1] " indepVar: Q115611.fctr,Q113181.fctr"
## [1] "myfit_mdl: setup complete: 0.689000 secs"
## Loading required package: rpart
## Aggregating results
## Selecting tuning parameters
## Fitting cp = 0 on full training set
## [1] "myfit_mdl: train complete: 2.243000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = "Max.cor.Y", : model's bestTune found at an extreme of
## tuneGrid for parameter: cp
## Loading required package: rpart.plot
## Call:
## rpart(formula = .outcome ~ ., control = list(minsplit = 20, minbucket = 7,
## cp = 0, maxcompete = 4, maxsurrogate = 5, usesurrogate = 2,
## surrogatestyle = 0, maxdepth = 30, xval = 0))
## n= 1966
##
## CP nsplit rel error
## 1 0.043975904 0 1.0000000
## 2 0.004819277 2 0.9120482
## 3 0.000000000 4 0.9024096
##
## Variable importance
## Q113181.fctrYes Q113181.fctrNo Q115611.fctrNo Q115611.fctrYes
## 34 29 20 17
##
## Node number 1: 1966 observations, complexity param=0.0439759
## predicted class=R expected loss=0.422177 P(node) =1
## class counts: 830 1136
## probabilities: 0.422 0.578
## left son=2 (1203 obs) right son=3 (763 obs)
## Primary splits:
## Q113181.fctrYes < 0.5 to the left, improve=23.53459, (0 missing)
## Q115611.fctrYes < 0.5 to the left, improve=22.57049, (0 missing)
## Q113181.fctrNo < 0.5 to the right, improve=20.68997, (0 missing)
## Q115611.fctrNo < 0.5 to the right, improve=18.43308, (0 missing)
## Surrogate splits:
## Q113181.fctrNo < 0.5 to the right, agree=0.853, adj=0.621, (0 split)
## Q115611.fctrYes < 0.5 to the left, agree=0.614, adj=0.005, (0 split)
##
## Node number 2: 1203 observations, complexity param=0.0439759
## predicted class=R expected loss=0.4837905 P(node) =0.6119023
## class counts: 582 621
## probabilities: 0.484 0.516
## left son=4 (609 obs) right son=5 (594 obs)
## Primary splits:
## Q115611.fctrNo < 0.5 to the right, improve=14.301960, (0 missing)
## Q115611.fctrYes < 0.5 to the left, improve=14.298210, (0 missing)
## Q113181.fctrNo < 0.5 to the right, improve= 1.999318, (0 missing)
## Surrogate splits:
## Q115611.fctrYes < 0.5 to the left, agree=0.800, adj=0.596, (0 split)
## Q113181.fctrNo < 0.5 to the right, agree=0.608, adj=0.207, (0 split)
##
## Node number 3: 763 observations
## predicted class=R expected loss=0.3250328 P(node) =0.3880977
## class counts: 248 515
## probabilities: 0.325 0.675
##
## Node number 4: 609 observations
## predicted class=D expected loss=0.4400657 P(node) =0.309766
## class counts: 341 268
## probabilities: 0.560 0.440
##
## Node number 5: 594 observations, complexity param=0.004819277
## predicted class=R expected loss=0.4057239 P(node) =0.3021363
## class counts: 241 353
## probabilities: 0.406 0.594
## left son=10 (240 obs) right son=11 (354 obs)
## Primary splits:
## Q115611.fctrYes < 0.5 to the left, improve=2.9913600, (0 missing)
## Q113181.fctrNo < 0.5 to the right, improve=0.1904018, (0 missing)
## Surrogate splits:
## Q113181.fctrNo < 0.5 to the left, agree=0.788, adj=0.475, (0 split)
##
## Node number 10: 240 observations, complexity param=0.004819277
## predicted class=R expected loss=0.4666667 P(node) =0.1220753
## class counts: 112 128
## probabilities: 0.467 0.533
## left son=20 (80 obs) right son=21 (160 obs)
## Primary splits:
## Q113181.fctrNo < 0.5 to the right, improve=1.666667, (0 missing)
##
## Node number 11: 354 observations
## predicted class=R expected loss=0.3644068 P(node) =0.180061
## class counts: 129 225
## probabilities: 0.364 0.636
##
## Node number 20: 80 observations
## predicted class=D expected loss=0.45 P(node) =0.04069176
## class counts: 44 36
## probabilities: 0.550 0.450
##
## Node number 21: 160 observations
## predicted class=R expected loss=0.425 P(node) =0.08138352
## class counts: 68 92
## probabilities: 0.425 0.575
##
## n= 1966
##
## node), split, n, loss, yval, (yprob)
## * denotes terminal node
##
## 1) root 1966 830 R (0.4221770 0.5778230)
## 2) Q113181.fctrYes< 0.5 1203 582 R (0.4837905 0.5162095)
## 4) Q115611.fctrNo>=0.5 609 268 D (0.5599343 0.4400657) *
## 5) Q115611.fctrNo< 0.5 594 241 R (0.4057239 0.5942761)
## 10) Q115611.fctrYes< 0.5 240 112 R (0.4666667 0.5333333)
## 20) Q113181.fctrNo>=0.5 80 36 D (0.5500000 0.4500000) *
## 21) Q113181.fctrNo< 0.5 160 68 R (0.4250000 0.5750000) *
## 11) Q115611.fctrYes>=0.5 354 129 R (0.3644068 0.6355932) *
## 3) Q113181.fctrYes>=0.5 763 248 R (0.3250328 0.6749672) *
## [1] "myfit_mdl: train diagnostics complete: 2.953000 secs"
## Prediction
## Reference D R
## D 385 445
## R 304 832
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.190234e-01 2.008451e-01 5.971380e-01 6.405531e-01 5.778230e-01
## AccuracyPValue McnemarPValue
## 1.108701e-04 3.129297e-07
## Prediction
## Reference D R
## D 0 208
## R 0 285
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.780933e-01 0.000000e+00 5.331249e-01 6.221196e-01 5.780933e-01
## AccuracyPValue McnemarPValue
## 5.191262e-01 1.022216e-46
## [1] "myfit_mdl: predict complete: 8.777000 secs"
## id feats max.nTuningRuns
## 1 Max.cor.Y##rcv#rpart Q115611.fctr,Q113181.fctr 5
## min.elapsedtime.everything min.elapsedtime.final max.AUCpROC.fit
## 1 1.549 0.012 0.5981249
## max.Sens.fit max.Spec.fit max.AUCROCR.fit opt.prob.threshold.fit
## 1 0.4638554 0.7323944 0.6123128 0.5
## max.f.score.fit max.Accuracy.fit max.AccuracyLower.fit
## 1 0.689598 0.617493 0.597138
## max.AccuracyUpper.fit max.Kappa.fit max.AUCpROC.OOB max.Sens.OOB
## 1 0.6405531 0.1964223 0.5326586 0.3846154
## max.Spec.OOB max.AUCROCR.OOB opt.prob.threshold.OOB max.f.score.OOB
## 1 0.6807018 0.5440283 0.4 0.7326478
## max.Accuracy.OOB max.AccuracyLower.OOB max.AccuracyUpper.OOB
## 1 0.5780933 0.5331249 0.6221196
## max.Kappa.OOB max.AccuracySD.fit max.KappaSD.fit
## 1 0 0.01545615 0.03240346
## [1] "myfit_mdl: exit: 8.839000 secs"
if ((length(glbFeatsDateTime) > 0) &&
(sum(grepl(paste(names(glbFeatsDateTime), "\\.day\\.minutes\\.poly\\.", sep = ""),
names(glbObsAll))) > 0)) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Max.cor.Y.Time.Poly"), major.inc = FALSE,
label.minor = "glmnet")
indepVars <- c(max_cor_y_x_vars,
grep(paste(names(glbFeatsDateTime), "\\.day\\.minutes\\.poly\\.", sep = ""),
names(glbObsAll), value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Time.Poly",
type = glb_model_type, trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
if ((length(glbFeatsDateTime) > 0) &&
(sum(grepl(paste(names(glbFeatsDateTime), "\\.last[[:digit:]]", sep = ""),
names(glbObsAll))) > 0)) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Max.cor.Y.Time.Lag"), major.inc = FALSE,
label.minor = "glmnet")
indepVars <- c(max_cor_y_x_vars,
grep(paste(names(glbFeatsDateTime), "\\.last[[:digit:]]", sep = ""),
names(glbObsAll), value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Time.Lag",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
if (length(glbFeatsText) > 0) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Txt.*"), major.inc = FALSE,
label.minor = "glmnet")
indepVars <- c(max_cor_y_x_vars)
for (txtFeat in names(glbFeatsText))
indepVars <- union(indepVars,
grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.(?!([T|P]\\.))", sep = ""),
names(glbObsAll), perl = TRUE, value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Text.nonTP",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
indepVars <- c(max_cor_y_x_vars)
for (txtFeat in names(glbFeatsText))
indepVars <- union(indepVars,
grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.T\\.", sep = ""),
names(glbObsAll), perl = TRUE, value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Text.onlyT",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
indepVars <- c(max_cor_y_x_vars)
for (txtFeat in names(glbFeatsText))
indepVars <- union(indepVars,
grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.P\\.", sep = ""),
names(glbObsAll), perl = TRUE, value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Text.onlyP",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
# Interactions.High.cor.Y
if (length(int_feats <- setdiff(setdiff(unique(glb_feats_df$cor.high.X), NA),
subset(glb_feats_df, nzv)$id)) > 0) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Interact.High.cor.Y"), major.inc = FALSE,
label.minor = "glmnet")
ret_lst <- myfit_mdl(mdl_specs_lst=myinit_mdl_specs_lst(mdl_specs_lst=list(
id.prefix="Interact.High.cor.Y",
type=glb_model_type, trainControl.method="repeatedcv",
trainControl.number=glb_rcv_n_folds, trainControl.repeats=glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method="glmnet")),
indepVar=c(max_cor_y_x_vars, paste(max_cor_y_x_vars[1], int_feats, sep=":")),
rsp_var=glb_rsp_var,
fit_df=glbObsFit, OOB_df=glbObsOOB)
}
## label step_major step_minor label_minor
## 4 fit.models_0_Max.cor.Y.rcv.*X* 1 3 glmnet
## 5 fit.models_0_Interact.High.cor.Y 1 4 glmnet
## bgn end elapsed
## 4 318.527 334.784 16.257
## 5 334.785 NA NA
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: Interact.High.cor.Y##rcv#glmnet"
## [1] " indepVar: Q115611.fctr,Q113181.fctr,Q115611.fctr:Q113181.fctr"
## [1] "myfit_mdl: setup complete: 0.689000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.1, lambda = 0.0017 on full training set
## [1] "myfit_mdl: train complete: 2.939000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = "Interact.High.cor.Y", : model's bestTune found at an
## extreme of tuneGrid for parameter: alpha
## Length Class Mode
## a0 71 -none- numeric
## beta 568 dgCMatrix S4
## df 71 -none- numeric
## dim 2 -none- numeric
## lambda 71 -none- numeric
## dev.ratio 71 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 8 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) Q113181.fctrNo
## 0.2977129 -0.4468599
## Q113181.fctrYes Q115611.fctrNo
## 0.4761540 -0.4110267
## Q115611.fctrYes Q113181.fctrNo:Q115611.fctrNo
## 0.6378051 0.3051491
## Q113181.fctrYes:Q115611.fctrNo Q113181.fctrYes:Q115611.fctrYes
## 0.1455212 -0.4588794
## [1] "max lambda < lambdaOpt:"
## (Intercept) Q113181.fctrNo
## 0.2984673 -0.4519473
## Q113181.fctrYes Q115611.fctrNo
## 0.4794180 -0.4156572
## Q115611.fctrYes Q113181.fctrNo:Q115611.fctrNo
## 0.6424388 0.3143260
## Q113181.fctrYes:Q115611.fctrNo Q113181.fctrYes:Q115611.fctrYes
## 0.1463672 -0.4679212
## [1] "myfit_mdl: train diagnostics complete: 3.594000 secs"
## Prediction
## Reference D R
## D 385 445
## R 304 832
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.190234e-01 2.008451e-01 5.971380e-01 6.405531e-01 5.778230e-01
## AccuracyPValue McnemarPValue
## 1.108701e-04 3.129297e-07
## Prediction
## Reference D R
## D 0 208
## R 0 285
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.780933e-01 0.000000e+00 5.331249e-01 6.221196e-01 5.780933e-01
## AccuracyPValue McnemarPValue
## 5.191262e-01 1.022216e-46
## [1] "myfit_mdl: predict complete: 9.323000 secs"
## id
## 1 Interact.High.cor.Y##rcv#glmnet
## feats max.nTuningRuns
## 1 Q115611.fctr,Q113181.fctr,Q115611.fctr:Q113181.fctr 25
## min.elapsedtime.everything min.elapsedtime.final max.AUCpROC.fit
## 1 2.243 0.055 0.5981249
## max.Sens.fit max.Spec.fit max.AUCROCR.fit opt.prob.threshold.fit
## 1 0.4638554 0.7323944 0.6231477 0.5
## max.f.score.fit max.Accuracy.fit max.AccuracyLower.fit
## 1 0.689598 0.6168144 0.597138
## max.AccuracyUpper.fit max.Kappa.fit max.AUCpROC.OOB max.Sens.OOB
## 1 0.6405531 0.1938108 0.5326586 0.3846154
## max.Spec.OOB max.AUCROCR.OOB opt.prob.threshold.OOB max.f.score.OOB
## 1 0.6807018 0.5660003 0.4 0.7326478
## max.Accuracy.OOB max.AccuracyLower.OOB max.AccuracyUpper.OOB
## 1 0.5780933 0.5331249 0.6221196
## max.Kappa.OOB max.AccuracySD.fit max.KappaSD.fit
## 1 0 0.01509263 0.03210463
## [1] "myfit_mdl: exit: 9.395000 secs"
# Low.cor.X
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Low.cor.X"), major.inc = FALSE,
label.minor = "glmnet")
## label step_major step_minor label_minor
## 5 fit.models_0_Interact.High.cor.Y 1 4 glmnet
## 6 fit.models_0_Low.cor.X 1 5 glmnet
## bgn end elapsed
## 5 334.785 344.193 9.408
## 6 344.193 NA NA
indepVar <- mygetIndepVar(glb_feats_df)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Low.cor.X",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVar, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: Low.cor.X##rcv#glmnet"
## [1] " indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr"
## [1] "myfit_mdl: setup complete: 0.709000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0344 on full training set
## [1] "myfit_mdl: train complete: 15.776000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = "Low.cor.X", : model's bestTune found at an extreme of
## tuneGrid for parameter: lambda
## Length Class Mode
## a0 79 -none- numeric
## beta 19592 dgCMatrix S4
## df 79 -none- numeric
## dim 2 -none- numeric
## lambda 79 -none- numeric
## dev.ratio 79 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 248 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) Hhold.fctrMKy
## 0.2633318704 0.0320158828
## Hhold.fctrPKn Hhold.fctrPKy
## -0.2202580490 -0.0318781202
## Q101163.fctrDad Q106272.fctrNo
## 0.1430746427 -0.0450052896
## Q106997.fctrYy Q108855.fctrYes!
## -0.0002262395 0.0427343392
## Q110740.fctrPC Q113181.fctrNo
## 0.0416540315 -0.1671631314
## Q113181.fctrYes Q115611.fctrNo
## 0.1309369866 -0.1744318522
## Q115611.fctrYes Q115899.fctrCs
## 0.1690463888 -0.0132375194
## Q116881.fctrHappy Q116881.fctrRight
## -0.0063713307 0.1174127433
## Q116953.fctrNo Q120379.fctrNo
## 0.0250992146 0.0045916356
## Q120472.fctrScience Q98197.fctrNo
## 0.0609351200 -0.0386164154
## Q98197.fctrYes Q98869.fctrNo
## 0.0697602827 -0.1493069928
## Q99480.fctrNo YOB.Age.fctr^6
## -0.0973638913 -0.0288455784
## Q109244.fctrNo:.clusterid.fctr2
## -0.0931887807
## [1] "max lambda < lambdaOpt:"
## (Intercept) Hhold.fctrMKy
## 0.2609630670 0.0402422204
## Hhold.fctrPKn Hhold.fctrPKy
## -0.2561411259 -0.0993139999
## Q101163.fctrDad Q106272.fctrNo
## 0.1542207150 -0.0534914847
## Q106997.fctrYy Q108855.fctrYes!
## -0.0196332841 0.0567852935
## Q110740.fctrPC Q113181.fctrNo
## 0.0549141024 -0.1750094841
## Q113181.fctrYes Q115195.fctrYes
## 0.1330889609 -0.0034194419
## Q115611.fctrNo Q115611.fctrYes
## -0.1815551426 0.1657421960
## Q115899.fctrCs Q116881.fctrHappy
## -0.0263626990 -0.0233200721
## Q116881.fctrRight Q116953.fctrNo
## 0.1176101966 0.0455947006
## Q120379.fctrNo Q120379.fctrYes
## 0.0154287092 -0.0003507129
## Q120472.fctrScience Q98197.fctrNo
## 0.0758954098 -0.0398247287
## Q98197.fctrYes Q98869.fctrNo
## 0.0743752115 -0.1678997175
## Q99480.fctrNo YOB.Age.fctr^6
## -0.1085844176 -0.0463361480
## Q109244.fctrNo:.clusterid.fctr2
## -0.0949497395
## [1] "myfit_mdl: train diagnostics complete: 16.449000 secs"
## Prediction
## Reference D R
## D 429 401
## R 326 810
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.302136e-01 2.327280e-01 6.084387e-01 6.515995e-01 5.778230e-01
## AccuracyPValue McnemarPValue
## 1.239263e-06 6.060166e-03
## Prediction
## Reference D R
## D 20 188
## R 15 270
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.882353e-01 4.903125e-02 5.433559e-01 6.320501e-01 5.780933e-01
## AccuracyPValue McnemarPValue
## 3.415120e-01 1.484209e-33
## [1] "myfit_mdl: predict complete: 26.138000 secs"
## id
## 1 Low.cor.X##rcv#glmnet
## feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 25 14.978 1.446
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.5828451 0.3144578 0.8512324 0.6581803
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.55 0.6902429 0.6037574
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.6084387 0.6515995 0.1307064
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.5370867 0.2355769 0.8385965 0.5838394
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0.45 0.7267833 0.5882353
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5433559 0.6320501 0.04903125
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.01089705 0.02153295
## [1] "myfit_mdl: exit: 26.407000 secs"
fit.models_0_chunk_df <-
myadd_chunk(fit.models_0_chunk_df, "fit.models_0_end", major.inc = FALSE,
label.minor = "teardown")
## label step_major step_minor label_minor bgn end
## 6 fit.models_0_Low.cor.X 1 5 glmnet 344.193 370.635
## 7 fit.models_0_end 1 6 teardown 370.636 NA
## elapsed
## 6 26.443
## 7 NA
rm(ret_lst)
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.models", major.inc = FALSE)
## label step_major step_minor label_minor bgn end elapsed
## 16 fit.models 8 0 0 302.157 370.65 68.493
## 17 fit.models 8 1 1 370.651 NA NA
## label step_major step_minor label_minor bgn end elapsed
## 1 fit.models_1_bgn 1 0 setup 375.428 NA NA
## label step_major step_minor label_minor bgn end
## 1 fit.models_1_bgn 1 0 setup 375.428 375.44
## 2 fit.models_1_All.X 1 1 setup 375.441 NA
## elapsed
## 1 0.013
## 2 NA
## label step_major step_minor label_minor bgn end
## 2 fit.models_1_All.X 1 1 setup 375.441 375.448
## 3 fit.models_1_All.X 1 2 glmnet 375.449 NA
## elapsed
## 2 0.007
## 3 NA
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: All.X##rcv#glmnet"
## [1] " indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr"
## [1] "myfit_mdl: setup complete: 0.683000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0344 on full training set
## [1] "myfit_mdl: train complete: 15.784000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = mdl_id_pfx, : model's bestTune found at an extreme of
## tuneGrid for parameter: lambda
## Length Class Mode
## a0 79 -none- numeric
## beta 19592 dgCMatrix S4
## df 79 -none- numeric
## dim 2 -none- numeric
## lambda 79 -none- numeric
## dev.ratio 79 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 248 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) Hhold.fctrMKy
## 0.2633318704 0.0320158828
## Hhold.fctrPKn Hhold.fctrPKy
## -0.2202580490 -0.0318781202
## Q101163.fctrDad Q106272.fctrNo
## 0.1430746427 -0.0450052896
## Q106997.fctrYy Q108855.fctrYes!
## -0.0002262395 0.0427343392
## Q110740.fctrPC Q113181.fctrNo
## 0.0416540315 -0.1671631314
## Q113181.fctrYes Q115611.fctrNo
## 0.1309369866 -0.1744318522
## Q115611.fctrYes Q115899.fctrCs
## 0.1690463888 -0.0132375194
## Q116881.fctrHappy Q116881.fctrRight
## -0.0063713307 0.1174127433
## Q116953.fctrNo Q120379.fctrNo
## 0.0250992146 0.0045916356
## Q120472.fctrScience Q98197.fctrNo
## 0.0609351200 -0.0386164154
## Q98197.fctrYes Q98869.fctrNo
## 0.0697602827 -0.1493069928
## Q99480.fctrNo YOB.Age.fctr^6
## -0.0973638913 -0.0288455784
## Q109244.fctrNo:.clusterid.fctr2
## -0.0931887807
## [1] "max lambda < lambdaOpt:"
## (Intercept) Hhold.fctrMKy
## 0.2609630670 0.0402422204
## Hhold.fctrPKn Hhold.fctrPKy
## -0.2561411259 -0.0993139999
## Q101163.fctrDad Q106272.fctrNo
## 0.1542207150 -0.0534914847
## Q106997.fctrYy Q108855.fctrYes!
## -0.0196332841 0.0567852935
## Q110740.fctrPC Q113181.fctrNo
## 0.0549141024 -0.1750094841
## Q113181.fctrYes Q115195.fctrYes
## 0.1330889609 -0.0034194419
## Q115611.fctrNo Q115611.fctrYes
## -0.1815551426 0.1657421960
## Q115899.fctrCs Q116881.fctrHappy
## -0.0263626990 -0.0233200721
## Q116881.fctrRight Q116953.fctrNo
## 0.1176101966 0.0455947006
## Q120379.fctrNo Q120379.fctrYes
## 0.0154287092 -0.0003507129
## Q120472.fctrScience Q98197.fctrNo
## 0.0758954098 -0.0398247287
## Q98197.fctrYes Q98869.fctrNo
## 0.0743752115 -0.1678997175
## Q99480.fctrNo YOB.Age.fctr^6
## -0.1085844176 -0.0463361480
## Q109244.fctrNo:.clusterid.fctr2
## -0.0949497395
## [1] "myfit_mdl: train diagnostics complete: 16.436000 secs"
## Prediction
## Reference D R
## D 429 401
## R 326 810
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.302136e-01 2.327280e-01 6.084387e-01 6.515995e-01 5.778230e-01
## AccuracyPValue McnemarPValue
## 1.239263e-06 6.060166e-03
## Prediction
## Reference D R
## D 20 188
## R 15 270
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.882353e-01 4.903125e-02 5.433559e-01 6.320501e-01 5.780933e-01
## AccuracyPValue McnemarPValue
## 3.415120e-01 1.484209e-33
## [1] "myfit_mdl: predict complete: 26.198000 secs"
## id
## 1 All.X##rcv#glmnet
## feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 25 15.017 1.449
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.5828451 0.3144578 0.8512324 0.6581803
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.55 0.6902429 0.6037574
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.6084387 0.6515995 0.1307064
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.5370867 0.2355769 0.8385965 0.5838394
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0.45 0.7267833 0.5882353
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5433559 0.6320501 0.04903125
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.01089705 0.02153295
## [1] "myfit_mdl: exit: 26.500000 secs"
## label step_major step_minor label_minor bgn end
## 3 fit.models_1_All.X 1 2 glmnet 375.449 401.954
## 4 fit.models_1_All.X 1 3 glm 401.955 NA
## elapsed
## 3 26.505
## 4 NA
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "myfit_mdl: fitting model: All.X##rcv#glm"
## [1] " indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr"
## [1] "myfit_mdl: setup complete: 0.693000 secs"
## + Fold1.Rep1: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold1.Rep1: parameter=none
## + Fold2.Rep1: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold2.Rep1: parameter=none
## + Fold3.Rep1: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold3.Rep1: parameter=none
## + Fold1.Rep2: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold1.Rep2: parameter=none
## + Fold2.Rep2: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold2.Rep2: parameter=none
## + Fold3.Rep2: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold3.Rep2: parameter=none
## + Fold1.Rep3: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold1.Rep3: parameter=none
## + Fold2.Rep3: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold2.Rep3: parameter=none
## + Fold3.Rep3: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold3.Rep3: parameter=none
## Aggregating results
## Fitting final model on full training set
## [1] "myfit_mdl: train complete: 7.404000 secs"
## parameter
## 1 none
##
## Call:
## NULL
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.1644 -1.0601 0.5681 0.9560 2.1298
##
## Coefficients: (8 not defined because of singularities)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.991269 0.607579 1.632 0.10278
## .rnorm -0.026116 0.052760 -0.495 0.62059
## Edn.fctr.L -0.200117 0.269349 -0.743 0.45750
## Edn.fctr.Q 0.092423 0.243957 0.379 0.70480
## Edn.fctr.C 0.007956 0.224101 0.036 0.97168
## `Edn.fctr^4` 0.151112 0.218389 0.692 0.48898
## `Edn.fctr^5` -0.133546 0.197684 -0.676 0.49932
## `Edn.fctr^6` -0.146765 0.175892 -0.834 0.40405
## `Edn.fctr^7` 0.147078 0.186185 0.790 0.42956
## Gender.fctrF 0.011825 0.448105 0.026 0.97895
## Gender.fctrM -0.165548 0.444319 -0.373 0.70945
## Hhold.fctrMKn -0.383869 0.326940 -1.174 0.24034
## Hhold.fctrMKy -0.031037 0.309017 -0.100 0.92000
## Hhold.fctrPKn -1.151954 0.431984 -2.667 0.00766
## Hhold.fctrPKy -1.553562 0.642533 -2.418 0.01561
## Hhold.fctrSKn -0.344671 0.280495 -1.229 0.21915
## Hhold.fctrSKy -0.626533 0.419341 -1.494 0.13515
## Income.fctr.L 0.140293 0.176960 0.793 0.42790
## Income.fctr.Q 0.213424 0.160257 1.332 0.18294
## Income.fctr.C 0.457172 0.159223 2.871 0.00409
## `Income.fctr^4` -0.050953 0.151499 -0.336 0.73662
## `Income.fctr^5` 0.120852 0.146113 0.827 0.40817
## `Income.fctr^6` -0.300383 0.140671 -2.135 0.03273
## Q100010.fctrNo -0.251679 0.415688 -0.605 0.54488
## Q100010.fctrYes -0.224876 0.398657 -0.564 0.57270
## Q100562.fctrNo -0.137303 0.358919 -0.383 0.70206
## Q100562.fctrYes 0.083711 0.340153 0.246 0.80561
## Q100680.fctrNo 0.032573 0.337265 0.097 0.92306
## Q100680.fctrYes 0.165225 0.331815 0.498 0.61853
## Q100689.fctrNo -0.303899 0.366854 -0.828 0.40745
## Q100689.fctrYes -0.523249 0.362749 -1.442 0.14917
## Q101162.fctrOptimist 0.775747 0.333537 2.326 0.02003
## Q101162.fctrPessimist 0.726961 0.339510 2.141 0.03226
## Q101163.fctrDad 0.008980 0.268282 0.033 0.97330
## Q101163.fctrMom -0.320727 0.273928 -1.171 0.24166
## Q101596.fctrNo 0.231840 0.300302 0.772 0.44010
## Q101596.fctrYes 0.249450 0.308642 0.808 0.41896
## Q102089.fctrOwn -0.010962 0.297526 -0.037 0.97061
## Q102089.fctrRent -0.114060 0.308644 -0.370 0.71172
## Q102289.fctrNo -0.100562 0.293930 -0.342 0.73225
## Q102289.fctrYes -0.054354 0.307430 -0.177 0.85966
## Q102674.fctrNo 0.561044 0.402473 1.394 0.16332
## Q102674.fctrYes 0.769268 0.411517 1.869 0.06157
## Q102687.fctrNo -0.605609 0.424565 -1.426 0.15375
## Q102687.fctrYes -0.637051 0.425598 -1.497 0.13444
## Q102906.fctrNo 0.097487 0.284649 0.342 0.73199
## Q102906.fctrYes 0.062005 0.292155 0.212 0.83193
## Q103293.fctrNo -0.072704 0.267864 -0.271 0.78607
## Q103293.fctrYes -0.072809 0.268384 -0.271 0.78617
## Q104996.fctrNo -0.347102 0.264119 -1.314 0.18878
## Q104996.fctrYes -0.381576 0.265751 -1.436 0.15105
## Q105655.fctrNo 0.297142 0.303546 0.979 0.32763
## Q105655.fctrYes 0.455145 0.305384 1.490 0.13612
## Q105840.fctrNo 0.017017 0.295353 0.058 0.95405
## Q105840.fctrYes 0.095910 0.303111 0.316 0.75169
## Q106042.fctrNo -0.125180 0.297548 -0.421 0.67397
## Q106042.fctrYes -0.339360 0.300704 -1.129 0.25909
## Q106272.fctrNo -0.537610 0.343165 -1.567 0.11720
## Q106272.fctrYes -0.209695 0.331839 -0.632 0.52744
## Q106388.fctrNo 0.023387 0.407917 0.057 0.95428
## Q106388.fctrYes 0.108551 0.423464 0.256 0.79769
## Q106389.fctrNo 0.442991 0.389143 1.138 0.25496
## Q106389.fctrYes 0.485941 0.391850 1.240 0.21493
## Q106993.fctrNo 0.275408 0.370709 0.743 0.45753
## Q106993.fctrYes 0.056690 0.346841 0.163 0.87017
## Q106997.fctrGr -0.153672 0.352755 -0.436 0.66310
## Q106997.fctrYy -0.461449 0.354946 -1.300 0.19358
## Q107491.fctrNo 0.017754 0.279028 0.064 0.94927
## Q107491.fctrYes -0.006292 0.240852 -0.026 0.97916
## Q107869.fctrNo 0.089522 0.244395 0.366 0.71414
## Q107869.fctrYes 0.276595 0.242028 1.143 0.25311
## `Q108342.fctrIn-person` -0.381403 0.306053 -1.246 0.21269
## Q108342.fctrOnline -0.528484 0.313324 -1.687 0.09166
## Q108343.fctrNo 0.180403 0.324368 0.556 0.57810
## Q108343.fctrYes 0.157429 0.332446 0.474 0.63582
## Q108617.fctrNo -0.491909 0.277115 -1.775 0.07588
## Q108617.fctrYes -0.247272 0.325857 -0.759 0.44795
## Q108754.fctrNo 0.344660 0.297549 1.158 0.24673
## Q108754.fctrYes 0.287588 0.308441 0.932 0.35113
## Q108855.fctrUmm... -0.199600 0.362767 -0.550 0.58217
## `Q108855.fctrYes!` 0.094827 0.359880 0.263 0.79217
## Q108856.fctrSocialize 0.100722 0.364501 0.276 0.78230
## Q108856.fctrSpace 0.171245 0.354685 0.483 0.62923
## Q108950.fctrCautious -0.003292 0.270213 -0.012 0.99028
## `Q108950.fctrRisk-friendly` -0.144772 0.281463 -0.514 0.60700
## Q109367.fctrNo 0.221249 0.289110 0.765 0.44411
## Q109367.fctrYes 0.230805 0.287418 0.803 0.42196
## Q110740.fctrMac -0.138829 0.227843 -0.609 0.54231
## Q110740.fctrPC 0.100075 0.223492 0.448 0.65431
## Q111220.fctrNo 0.057332 0.246155 0.233 0.81583
## Q111220.fctrYes -0.185861 0.259667 -0.716 0.47414
## Q111580.fctrDemanding 0.256024 0.250207 1.023 0.30619
## Q111580.fctrSupportive 0.098008 0.238604 0.411 0.68125
## Q111848.fctrNo -0.074464 0.266899 -0.279 0.78025
## Q111848.fctrYes -0.127080 0.262682 -0.484 0.62854
## Q112270.fctrNo -0.046855 0.245450 -0.191 0.84861
## Q112270.fctrYes -0.097845 0.248400 -0.394 0.69366
## Q112478.fctrNo 0.721439 0.298843 2.414 0.01577
## Q112478.fctrYes 0.567795 0.293957 1.932 0.05341
## Q112512.fctrNo -0.551262 0.315967 -1.745 0.08104
## Q112512.fctrYes -0.490866 0.289049 -1.698 0.08947
## Q113181.fctrNo -0.296604 0.270014 -1.098 0.27200
## Q113181.fctrYes 0.000738 0.412023 0.002 0.99857
## Q113583.fctrTalk -0.150933 0.370952 -0.407 0.68410
## Q113583.fctrTunes -0.104800 0.366011 -0.286 0.77462
## Q113584.fctrPeople 0.185195 0.380943 0.486 0.62686
## Q113584.fctrTechnology 0.241907 0.379948 0.637 0.52433
## Q113992.fctrNo 0.009461 0.286656 0.033 0.97367
## Q113992.fctrYes 0.003153 0.298870 0.011 0.99158
## Q114152.fctrNo 0.026482 0.265648 0.100 0.92059
## Q114152.fctrYes -0.202549 0.281017 -0.721 0.47105
## Q114386.fctrMysterious -0.092848 0.286260 -0.324 0.74567
## Q114386.fctrTMI -0.004572 0.289476 -0.016 0.98740
## Q114517.fctrNo -0.862809 0.345739 -2.496 0.01258
## Q114517.fctrYes -0.655434 0.355997 -1.841 0.06560
## Q114748.fctrNo 0.443493 0.350601 1.265 0.20589
## Q114748.fctrYes 0.424823 0.349327 1.216 0.22394
## Q114961.fctrNo 0.126472 0.297312 0.425 0.67056
## Q114961.fctrYes 0.042861 0.294965 0.145 0.88447
## Q115195.fctrNo -0.439683 0.302398 -1.454 0.14595
## Q115195.fctrYes -0.528359 0.294417 -1.795 0.07272
## Q115390.fctrNo 0.207017 0.248220 0.834 0.40428
## Q115390.fctrYes 0.164262 0.239659 0.685 0.49309
## Q115602.fctrNo -0.016550 0.335607 -0.049 0.96067
## Q115602.fctrYes -0.344335 0.312848 -1.101 0.27105
## Q115610.fctrNo 0.084190 0.357210 0.236 0.81367
## Q115610.fctrYes 0.224638 0.337380 0.666 0.50552
## Q115611.fctrNo 0.007025 0.356191 0.020 0.98426
## Q115611.fctrYes 0.488383 0.374470 1.304 0.19217
## Q115777.fctrEnd 0.012074 0.296492 0.041 0.96752
## Q115777.fctrStart -0.076337 0.290555 -0.263 0.79276
## Q115899.fctrCs -0.368543 0.287158 -1.283 0.19935
## Q115899.fctrMe -0.142400 0.282830 -0.503 0.61463
## Q116197.fctrA.M. 0.126045 0.273254 0.461 0.64460
## Q116197.fctrP.M. 0.177213 0.262513 0.675 0.49963
## Q116441.fctrNo 0.115255 0.384738 0.300 0.76451
## Q116441.fctrYes 0.013157 0.394265 0.033 0.97338
## Q116448.fctrNo -0.018798 0.342179 -0.055 0.95619
## Q116448.fctrYes -0.053211 0.344872 -0.154 0.87738
## Q116601.fctrNo -0.111587 0.355381 -0.314 0.75353
## Q116601.fctrYes 0.077317 0.329400 0.235 0.81442
## Q116797.fctrNo 0.191443 0.309536 0.618 0.53626
## Q116797.fctrYes 0.323770 0.319805 1.012 0.31135
## Q116881.fctrHappy -0.507626 0.304706 -1.666 0.09572
## Q116881.fctrRight -0.130347 0.316838 -0.411 0.68078
## Q116953.fctrNo 0.580040 0.316724 1.831 0.06704
## Q116953.fctrYes 0.174950 0.302570 0.578 0.56312
## `Q117186.fctrCool headed` 0.016804 0.303255 0.055 0.95581
## `Q117186.fctrHot headed` 0.092086 0.309919 0.297 0.76637
## `Q117193.fctrOdd hours` -0.024769 0.288386 -0.086 0.93155
## `Q117193.fctrStandard hours` 0.075606 0.282990 0.267 0.78934
## Q118117.fctrNo -0.100291 0.317549 -0.316 0.75213
## Q118117.fctrYes -0.216540 0.317406 -0.682 0.49510
## Q118232.fctrId -0.181742 0.269463 -0.674 0.50002
## Q118232.fctrPr -0.117636 0.265460 -0.443 0.65767
## Q118233.fctrNo -0.831345 0.443194 -1.876 0.06068
## Q118233.fctrYes -1.044184 0.453952 -2.300 0.02144
## Q118237.fctrNo 1.089610 0.451383 2.414 0.01578
## Q118237.fctrYes 1.015384 0.452768 2.243 0.02492
## Q118892.fctrNo -0.246224 0.288553 -0.853 0.39349
## Q118892.fctrYes -0.125936 0.284256 -0.443 0.65774
## Q119334.fctrNo 0.066805 0.270111 0.247 0.80466
## Q119334.fctrYes 0.128987 0.264976 0.487 0.62641
## Q119650.fctrGiving 0.239632 0.267602 0.895 0.37053
## Q119650.fctrReceiving 0.201165 0.288351 0.698 0.48540
## Q119851.fctrNo 0.305315 0.324779 0.940 0.34718
## Q119851.fctrYes 0.344918 0.328731 1.049 0.29407
## Q120012.fctrNo -0.016919 0.348819 -0.049 0.96132
## Q120012.fctrYes -0.079042 0.348109 -0.227 0.82038
## Q120014.fctrNo -0.204980 0.299233 -0.685 0.49333
## Q120014.fctrYes -0.169146 0.296006 -0.571 0.56771
## `Q120194.fctrStudy first` -0.331644 0.285999 -1.160 0.24621
## `Q120194.fctrTry first` -0.297702 0.290318 -1.025 0.30516
## Q120379.fctrNo 0.121968 0.311697 0.391 0.69557
## Q120379.fctrYes -0.201618 0.314084 -0.642 0.52092
## Q120472.fctrArt 0.107977 0.310378 0.348 0.72792
## Q120472.fctrScience 0.364436 0.293025 1.244 0.21361
## Q120650.fctrNo 0.219661 0.341400 0.643 0.51996
## Q120650.fctrYes 0.211490 0.272041 0.777 0.43691
## Q120978.fctrNo 0.075180 0.318447 0.236 0.81337
## Q120978.fctrYes -0.105483 0.315435 -0.334 0.73807
## Q121011.fctrNo -0.222398 0.318486 -0.698 0.48499
## Q121011.fctrYes -0.203567 0.321108 -0.634 0.52611
## Q121699.fctrNo -1.053082 0.564338 -1.866 0.06203
## Q121699.fctrYes -1.265869 0.558970 -2.265 0.02353
## Q121700.fctrNo 1.307652 0.547691 2.388 0.01696
## Q121700.fctrYes 1.023719 0.572220 1.789 0.07361
## Q122120.fctrNo -0.306131 0.282213 -1.085 0.27803
## Q122120.fctrYes -0.195951 0.298586 -0.656 0.51165
## Q122769.fctrNo 0.155830 0.419425 0.372 0.71024
## Q122769.fctrYes 0.173374 0.425903 0.407 0.68395
## Q122770.fctrNo -0.702183 0.591519 -1.187 0.23519
## Q122770.fctrYes -0.721058 0.591841 -1.218 0.22310
## Q122771.fctrPc 1.236948 0.552640 2.238 0.02520
## Q122771.fctrPt 1.408992 0.566957 2.485 0.01295
## Q123464.fctrNo -0.167522 0.273040 -0.614 0.53952
## Q123464.fctrYes 0.054452 0.370229 0.147 0.88307
## Q123621.fctrNo -0.011323 0.275543 -0.041 0.96722
## Q123621.fctrYes 0.254244 0.275580 0.923 0.35623
## Q124122.fctrNo -0.317951 0.229051 -1.388 0.16510
## Q124122.fctrYes -0.396971 0.223840 -1.773 0.07615
## Q124742.fctrNo -0.090772 0.146243 -0.621 0.53480
## Q124742.fctrYes 0.160048 0.168621 0.949 0.34254
## Q96024.fctrNo -0.061880 0.220550 -0.281 0.77904
## Q96024.fctrYes -0.137061 0.210512 -0.651 0.51499
## `Q98059.fctrOnly-child` -0.278136 0.438231 -0.635 0.52564
## Q98059.fctrYes -0.416747 0.397357 -1.049 0.29427
## Q98078.fctrNo -0.419189 0.346834 -1.209 0.22681
## Q98078.fctrYes -0.338497 0.351357 -0.963 0.33535
## Q98197.fctrNo 0.264334 0.356112 0.742 0.45792
## Q98197.fctrYes 0.528051 0.361524 1.461 0.14412
## Q98578.fctrNo 0.402934 0.270069 1.492 0.13571
## Q98578.fctrYes 0.489976 0.276778 1.770 0.07668
## Q98869.fctrNo -0.306007 0.276007 -1.109 0.26756
## Q98869.fctrYes 0.082783 0.244636 0.338 0.73507
## Q99480.fctrNo -0.569692 0.361897 -1.574 0.11545
## Q99480.fctrYes -0.308076 0.345271 -0.892 0.37225
## Q99581.fctrNo 0.506300 0.379873 1.333 0.18259
## Q99581.fctrYes 0.514153 0.404803 1.270 0.20404
## Q99716.fctrNo -0.139306 0.321388 -0.433 0.66469
## Q99716.fctrYes 0.046676 0.385354 0.121 0.90359
## `Q99982.fctrCheck!` -0.103982 0.379256 -0.274 0.78395
## Q99982.fctrNope -0.146012 0.379269 -0.385 0.70025
## YOB.Age.fctr.L -0.143160 0.485123 -0.295 0.76792
## YOB.Age.fctr.Q -0.195212 0.413519 -0.472 0.63687
## YOB.Age.fctr.C 0.713208 0.405735 1.758 0.07878
## `YOB.Age.fctr^4` 0.220896 0.437639 0.505 0.61374
## `YOB.Age.fctr^5` 0.424424 0.428171 0.991 0.32156
## `YOB.Age.fctr^6` -0.708352 0.366381 -1.933 0.05319
## `YOB.Age.fctr^7` -0.011800 0.348400 -0.034 0.97298
## `YOB.Age.fctr^8` 0.635501 0.357048 1.780 0.07510
## `Q109244.fctrNA:.clusterid.fctr1` NA NA NA NA
## `Q109244.fctrNo:.clusterid.fctr1` 0.079753 0.312113 0.256 0.79832
## `Q109244.fctrYes:.clusterid.fctr1` NA NA NA NA
## `Q109244.fctrNA:.clusterid.fctr2` NA NA NA NA
## `Q109244.fctrNo:.clusterid.fctr2` -0.165621 0.197001 -0.841 0.40051
## `Q109244.fctrYes:.clusterid.fctr2` NA NA NA NA
## `Q109244.fctrNA:.clusterid.fctr3` NA NA NA NA
## `Q109244.fctrNo:.clusterid.fctr3` NA NA NA NA
## `Q109244.fctrYes:.clusterid.fctr3` NA NA NA NA
## `YOB.Age.fctrNA:YOB.Age.dff` NA NA NA NA
## `YOB.Age.fctr(15,20]:YOB.Age.dff` -0.077511 0.138920 -0.558 0.57688
## `YOB.Age.fctr(20,25]:YOB.Age.dff` -0.058832 0.112939 -0.521 0.60242
## `YOB.Age.fctr(25,30]:YOB.Age.dff` 0.091120 0.111387 0.818 0.41333
## `YOB.Age.fctr(30,35]:YOB.Age.dff` -0.210284 0.105677 -1.990 0.04660
## `YOB.Age.fctr(35,40]:YOB.Age.dff` -0.038405 0.115339 -0.333 0.73915
## `YOB.Age.fctr(40,50]:YOB.Age.dff` 0.040738 0.048050 0.848 0.39654
## `YOB.Age.fctr(50,65]:YOB.Age.dff` 0.006217 0.036588 0.170 0.86507
## `YOB.Age.fctr(65,90]:YOB.Age.dff` -0.053749 0.056666 -0.949 0.34286
##
## (Intercept)
## .rnorm
## Edn.fctr.L
## Edn.fctr.Q
## Edn.fctr.C
## `Edn.fctr^4`
## `Edn.fctr^5`
## `Edn.fctr^6`
## `Edn.fctr^7`
## Gender.fctrF
## Gender.fctrM
## Hhold.fctrMKn
## Hhold.fctrMKy
## Hhold.fctrPKn **
## Hhold.fctrPKy *
## Hhold.fctrSKn
## Hhold.fctrSKy
## Income.fctr.L
## Income.fctr.Q
## Income.fctr.C **
## `Income.fctr^4`
## `Income.fctr^5`
## `Income.fctr^6` *
## Q100010.fctrNo
## Q100010.fctrYes
## Q100562.fctrNo
## Q100562.fctrYes
## Q100680.fctrNo
## Q100680.fctrYes
## Q100689.fctrNo
## Q100689.fctrYes
## Q101162.fctrOptimist *
## Q101162.fctrPessimist *
## Q101163.fctrDad
## Q101163.fctrMom
## Q101596.fctrNo
## Q101596.fctrYes
## Q102089.fctrOwn
## Q102089.fctrRent
## Q102289.fctrNo
## Q102289.fctrYes
## Q102674.fctrNo
## Q102674.fctrYes .
## Q102687.fctrNo
## Q102687.fctrYes
## Q102906.fctrNo
## Q102906.fctrYes
## Q103293.fctrNo
## Q103293.fctrYes
## Q104996.fctrNo
## Q104996.fctrYes
## Q105655.fctrNo
## Q105655.fctrYes
## Q105840.fctrNo
## Q105840.fctrYes
## Q106042.fctrNo
## Q106042.fctrYes
## Q106272.fctrNo
## Q106272.fctrYes
## Q106388.fctrNo
## Q106388.fctrYes
## Q106389.fctrNo
## Q106389.fctrYes
## Q106993.fctrNo
## Q106993.fctrYes
## Q106997.fctrGr
## Q106997.fctrYy
## Q107491.fctrNo
## Q107491.fctrYes
## Q107869.fctrNo
## Q107869.fctrYes
## `Q108342.fctrIn-person`
## Q108342.fctrOnline .
## Q108343.fctrNo
## Q108343.fctrYes
## Q108617.fctrNo .
## Q108617.fctrYes
## Q108754.fctrNo
## Q108754.fctrYes
## Q108855.fctrUmm...
## `Q108855.fctrYes!`
## Q108856.fctrSocialize
## Q108856.fctrSpace
## Q108950.fctrCautious
## `Q108950.fctrRisk-friendly`
## Q109367.fctrNo
## Q109367.fctrYes
## Q110740.fctrMac
## Q110740.fctrPC
## Q111220.fctrNo
## Q111220.fctrYes
## Q111580.fctrDemanding
## Q111580.fctrSupportive
## Q111848.fctrNo
## Q111848.fctrYes
## Q112270.fctrNo
## Q112270.fctrYes
## Q112478.fctrNo *
## Q112478.fctrYes .
## Q112512.fctrNo .
## Q112512.fctrYes .
## Q113181.fctrNo
## Q113181.fctrYes
## Q113583.fctrTalk
## Q113583.fctrTunes
## Q113584.fctrPeople
## Q113584.fctrTechnology
## Q113992.fctrNo
## Q113992.fctrYes
## Q114152.fctrNo
## Q114152.fctrYes
## Q114386.fctrMysterious
## Q114386.fctrTMI
## Q114517.fctrNo *
## Q114517.fctrYes .
## Q114748.fctrNo
## Q114748.fctrYes
## Q114961.fctrNo
## Q114961.fctrYes
## Q115195.fctrNo
## Q115195.fctrYes .
## Q115390.fctrNo
## Q115390.fctrYes
## Q115602.fctrNo
## Q115602.fctrYes
## Q115610.fctrNo
## Q115610.fctrYes
## Q115611.fctrNo
## Q115611.fctrYes
## Q115777.fctrEnd
## Q115777.fctrStart
## Q115899.fctrCs
## Q115899.fctrMe
## Q116197.fctrA.M.
## Q116197.fctrP.M.
## Q116441.fctrNo
## Q116441.fctrYes
## Q116448.fctrNo
## Q116448.fctrYes
## Q116601.fctrNo
## Q116601.fctrYes
## Q116797.fctrNo
## Q116797.fctrYes
## Q116881.fctrHappy .
## Q116881.fctrRight
## Q116953.fctrNo .
## Q116953.fctrYes
## `Q117186.fctrCool headed`
## `Q117186.fctrHot headed`
## `Q117193.fctrOdd hours`
## `Q117193.fctrStandard hours`
## Q118117.fctrNo
## Q118117.fctrYes
## Q118232.fctrId
## Q118232.fctrPr
## Q118233.fctrNo .
## Q118233.fctrYes *
## Q118237.fctrNo *
## Q118237.fctrYes *
## Q118892.fctrNo
## Q118892.fctrYes
## Q119334.fctrNo
## Q119334.fctrYes
## Q119650.fctrGiving
## Q119650.fctrReceiving
## Q119851.fctrNo
## Q119851.fctrYes
## Q120012.fctrNo
## Q120012.fctrYes
## Q120014.fctrNo
## Q120014.fctrYes
## `Q120194.fctrStudy first`
## `Q120194.fctrTry first`
## Q120379.fctrNo
## Q120379.fctrYes
## Q120472.fctrArt
## Q120472.fctrScience
## Q120650.fctrNo
## Q120650.fctrYes
## Q120978.fctrNo
## Q120978.fctrYes
## Q121011.fctrNo
## Q121011.fctrYes
## Q121699.fctrNo .
## Q121699.fctrYes *
## Q121700.fctrNo *
## Q121700.fctrYes .
## Q122120.fctrNo
## Q122120.fctrYes
## Q122769.fctrNo
## Q122769.fctrYes
## Q122770.fctrNo
## Q122770.fctrYes
## Q122771.fctrPc *
## Q122771.fctrPt *
## Q123464.fctrNo
## Q123464.fctrYes
## Q123621.fctrNo
## Q123621.fctrYes
## Q124122.fctrNo
## Q124122.fctrYes .
## Q124742.fctrNo
## Q124742.fctrYes
## Q96024.fctrNo
## Q96024.fctrYes
## `Q98059.fctrOnly-child`
## Q98059.fctrYes
## Q98078.fctrNo
## Q98078.fctrYes
## Q98197.fctrNo
## Q98197.fctrYes
## Q98578.fctrNo
## Q98578.fctrYes .
## Q98869.fctrNo
## Q98869.fctrYes
## Q99480.fctrNo
## Q99480.fctrYes
## Q99581.fctrNo
## Q99581.fctrYes
## Q99716.fctrNo
## Q99716.fctrYes
## `Q99982.fctrCheck!`
## Q99982.fctrNope
## YOB.Age.fctr.L
## YOB.Age.fctr.Q
## YOB.Age.fctr.C .
## `YOB.Age.fctr^4`
## `YOB.Age.fctr^5`
## `YOB.Age.fctr^6` .
## `YOB.Age.fctr^7`
## `YOB.Age.fctr^8` .
## `Q109244.fctrNA:.clusterid.fctr1`
## `Q109244.fctrNo:.clusterid.fctr1`
## `Q109244.fctrYes:.clusterid.fctr1`
## `Q109244.fctrNA:.clusterid.fctr2`
## `Q109244.fctrNo:.clusterid.fctr2`
## `Q109244.fctrYes:.clusterid.fctr2`
## `Q109244.fctrNA:.clusterid.fctr3`
## `Q109244.fctrNo:.clusterid.fctr3`
## `Q109244.fctrYes:.clusterid.fctr3`
## `YOB.Age.fctrNA:YOB.Age.dff`
## `YOB.Age.fctr(15,20]:YOB.Age.dff`
## `YOB.Age.fctr(20,25]:YOB.Age.dff`
## `YOB.Age.fctr(25,30]:YOB.Age.dff`
## `YOB.Age.fctr(30,35]:YOB.Age.dff` *
## `YOB.Age.fctr(35,40]:YOB.Age.dff`
## `YOB.Age.fctr(40,50]:YOB.Age.dff`
## `YOB.Age.fctr(50,65]:YOB.Age.dff`
## `YOB.Age.fctr(65,90]:YOB.Age.dff`
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 2677.6 on 1965 degrees of freedom
## Residual deviance: 2315.4 on 1725 degrees of freedom
## AIC: 2797.4
##
## Number of Fisher Scoring iterations: 4
##
## [1] "mydisplayOutliers: "
##
## No Studentized residuals with Bonferonni p < 0.05
## Largest |rstudent|:
## rstudent unadjusted p-value Bonferonni p
## 3434 -2.477046 0.013248 NA
## [1] ""
## .rstudent .dffits .hatvalues
## Min. :-2.47705 Min. :-1.07014 Min. :0.01836
## 1st Qu.:-1.11072 1st Qu.:-0.36992 1st Qu.:0.08418
## Median : 0.58007 Median : 0.13647 Median :0.10762
## Mean : 0.04208 Mean : 0.01383 Mean :0.12258
## 3rd Qu.: 1.00095 3rd Qu.: 0.33209 3rd Qu.:0.14522
## Max. : 2.25788 Max. : 1.19158 Max. :0.40892
## [1] "myfit_mdl: train diagnostics complete: 8.720000 secs"
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## Prediction
## Reference D R
## D 441 389
## R 244 892
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.780264e-01 3.241638e-01 6.568648e-01 6.986558e-01 5.778230e-01
## AccuracyPValue McnemarPValue
## 4.415879e-20 1.043601e-08
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## Prediction
## Reference D R
## D 7 201
## R 4 281
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.841785e-01 2.249712e-02 5.392613e-01 6.280802e-01 5.780933e-01
## AccuracyPValue McnemarPValue
## 4.107189e-01 1.177443e-42
## [1] "myfit_mdl: predict complete: 18.633000 secs"
## id
## 1 All.X##rcv#glm
## feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 1 6.627 0.552
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.6582683 0.5313253 0.7852113 0.7330763
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.5 0.7381051 0.5445999
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.6568648 0.6986558 0.05614901
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.5297993 0.3894231 0.6701754 0.5436235
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0.15 0.7327249 0.5841785
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5392613 0.6280802 0.02249712
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.0164593 0.03436128
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## [1] "myfit_mdl: exit: 18.953000 secs"
## label step_major step_minor label_minor bgn end
## 4 fit.models_1_All.X 1 3 glm 401.955 420.939
## 5 fit.models_1_preProc 1 4 preProc 420.939 NA
## elapsed
## 4 18.984
## 5 NA
## id
## Low.cor.X##rcv#glmnet Low.cor.X##rcv#glmnet
## All.X##rcv#glmnet All.X##rcv#glmnet
## All.X##rcv#glm All.X##rcv#glm
## Max.cor.Y.rcv.1X1###glmnet Max.cor.Y.rcv.1X1###glmnet
## Interact.High.cor.Y##rcv#glmnet Interact.High.cor.Y##rcv#glmnet
## feats
## Low.cor.X##rcv#glmnet Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr
## All.X##rcv#glmnet Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr
## All.X##rcv#glm Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr
## Max.cor.Y.rcv.1X1###glmnet Q115611.fctr,Q113181.fctr
## Interact.High.cor.Y##rcv#glmnet Q115611.fctr,Q113181.fctr,Q115611.fctr:Q113181.fctr
## max.nTuningRuns min.elapsedtime.everything
## Low.cor.X##rcv#glmnet 25 14.978
## All.X##rcv#glmnet 25 15.017
## All.X##rcv#glm 1 6.627
## Max.cor.Y.rcv.1X1###glmnet 0 0.807
## Interact.High.cor.Y##rcv#glmnet 25 2.243
## min.elapsedtime.final max.AUCpROC.fit
## Low.cor.X##rcv#glmnet 1.446 0.5828451
## All.X##rcv#glmnet 1.449 0.5828451
## All.X##rcv#glm 0.552 0.6582683
## Max.cor.Y.rcv.1X1###glmnet 0.029 0.5770809
## Interact.High.cor.Y##rcv#glmnet 0.055 0.5981249
## max.Sens.fit max.Spec.fit max.AUCROCR.fit
## Low.cor.X##rcv#glmnet 0.3144578 0.8512324 0.6581803
## All.X##rcv#glmnet 0.3144578 0.8512324 0.6581803
## All.X##rcv#glm 0.5313253 0.7852113 0.7330763
## Max.cor.Y.rcv.1X1###glmnet 0.3566265 0.7975352 0.6231477
## Interact.High.cor.Y##rcv#glmnet 0.4638554 0.7323944 0.6231477
## opt.prob.threshold.fit max.f.score.fit
## Low.cor.X##rcv#glmnet 0.55 0.6902429
## All.X##rcv#glmnet 0.55 0.6902429
## All.X##rcv#glm 0.50 0.7381051
## Max.cor.Y.rcv.1X1###glmnet 0.55 0.6895980
## Interact.High.cor.Y##rcv#glmnet 0.50 0.6895980
## max.Accuracy.fit max.AccuracyLower.fit
## Low.cor.X##rcv#glmnet 0.6037574 0.6084387
## All.X##rcv#glmnet 0.6037574 0.6084387
## All.X##rcv#glm 0.5445999 0.6568648
## Max.cor.Y.rcv.1X1###glmnet 0.6190234 0.5971380
## Interact.High.cor.Y##rcv#glmnet 0.6168144 0.5971380
## max.AccuracyUpper.fit max.Kappa.fit
## Low.cor.X##rcv#glmnet 0.6515995 0.13070637
## All.X##rcv#glmnet 0.6515995 0.13070637
## All.X##rcv#glm 0.6986558 0.05614901
## Max.cor.Y.rcv.1X1###glmnet 0.6405531 0.20084510
## Interact.High.cor.Y##rcv#glmnet 0.6405531 0.19381078
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB
## Low.cor.X##rcv#glmnet 0.5370867 0.2355769 0.8385965
## All.X##rcv#glmnet 0.5370867 0.2355769 0.8385965
## All.X##rcv#glm 0.5297993 0.3894231 0.6701754
## Max.cor.Y.rcv.1X1###glmnet 0.5332490 0.2980769 0.7684211
## Interact.High.cor.Y##rcv#glmnet 0.5326586 0.3846154 0.6807018
## max.AUCROCR.OOB opt.prob.threshold.OOB
## Low.cor.X##rcv#glmnet 0.5838394 0.45
## All.X##rcv#glmnet 0.5838394 0.45
## All.X##rcv#glm 0.5436235 0.15
## Max.cor.Y.rcv.1X1###glmnet 0.5660003 0.40
## Interact.High.cor.Y##rcv#glmnet 0.5660003 0.40
## max.f.score.OOB max.Accuracy.OOB
## Low.cor.X##rcv#glmnet 0.7267833 0.5882353
## All.X##rcv#glmnet 0.7267833 0.5882353
## All.X##rcv#glm 0.7327249 0.5841785
## Max.cor.Y.rcv.1X1###glmnet 0.7326478 0.5780933
## Interact.High.cor.Y##rcv#glmnet 0.7326478 0.5780933
## max.AccuracyLower.OOB
## Low.cor.X##rcv#glmnet 0.5433559
## All.X##rcv#glmnet 0.5433559
## All.X##rcv#glm 0.5392613
## Max.cor.Y.rcv.1X1###glmnet 0.5331249
## Interact.High.cor.Y##rcv#glmnet 0.5331249
## max.AccuracyUpper.OOB max.Kappa.OOB
## Low.cor.X##rcv#glmnet 0.6320501 0.04903125
## All.X##rcv#glmnet 0.6320501 0.04903125
## All.X##rcv#glm 0.6280802 0.02249712
## Max.cor.Y.rcv.1X1###glmnet 0.6221196 0.00000000
## Interact.High.cor.Y##rcv#glmnet 0.6221196 0.00000000
## max.AccuracySD.fit max.KappaSD.fit
## Low.cor.X##rcv#glmnet 0.01089705 0.02153295
## All.X##rcv#glmnet 0.01089705 0.02153295
## All.X##rcv#glm 0.01645930 0.03436128
## Max.cor.Y.rcv.1X1###glmnet NA NA
## Interact.High.cor.Y##rcv#glmnet 0.01509263 0.03210463
## min.elapsedtime.everything
## Random###myrandom_classfr 0.397
## MFO###myMFO_classfr 0.580
## Max.cor.Y.rcv.1X1###glmnet 0.807
## Max.cor.Y##rcv#rpart 1.549
## Interact.High.cor.Y##rcv#glmnet 2.243
## All.X##rcv#glm 6.627
## Low.cor.X##rcv#glmnet 14.978
## All.X##rcv#glmnet 15.017
## label step_major step_minor label_minor bgn end
## 5 fit.models_1_preProc 1 4 preProc 420.939 421.016
## 6 fit.models_1_end 1 5 teardown 421.016 NA
## elapsed
## 5 0.077
## 6 NA
## label step_major step_minor label_minor bgn end elapsed
## 17 fit.models 8 1 1 370.651 421.026 50.375
## 18 fit.models 8 2 2 421.026 NA NA
## label step_major step_minor label_minor bgn end elapsed
## 1 fit.models_2_bgn 1 0 setup 423.366 NA NA
## Warning: max.AccuracyUpper.fit already exists in glb_models_df
## [1] "var:max.KappaSD.fit"
## Warning: Removed 4 rows containing missing values (geom_errorbar).
## quartz_off_screen
## 2
## Warning: Removed 4 rows containing missing values (geom_errorbar).
## id max.Accuracy.OOB max.AUCROCR.OOB
## 6 Low.cor.X##rcv#glmnet 0.5882353 0.5838394
## 7 All.X##rcv#glmnet 0.5882353 0.5838394
## 8 All.X##rcv#glm 0.5841785 0.5436235
## 3 Max.cor.Y.rcv.1X1###glmnet 0.5780933 0.5660003
## 5 Interact.High.cor.Y##rcv#glmnet 0.5780933 0.5660003
## 4 Max.cor.Y##rcv#rpart 0.5780933 0.5440283
## 2 Random###myrandom_classfr 0.5780933 0.5142038
## 1 MFO###myMFO_classfr 0.5780933 0.5000000
## max.AUCpROC.OOB min.elapsedtime.everything max.Accuracy.fit
## 6 0.5370867 14.978 0.6037574
## 7 0.5370867 15.017 0.6037574
## 8 0.5297993 6.627 0.5445999
## 3 0.5332490 0.807 0.6190234
## 5 0.5326586 2.243 0.6168144
## 4 0.5326586 1.549 0.6174930
## 2 0.4988023 0.397 0.5778230
## 1 0.5000000 0.580 0.5778230
## opt.prob.threshold.fit opt.prob.threshold.OOB
## 6 0.55 0.45
## 7 0.55 0.45
## 8 0.50 0.15
## 3 0.55 0.40
## 5 0.50 0.40
## 4 0.50 0.40
## 2 0.40 0.40
## 1 0.40 0.40
## [1] "Metrics used for model selection:"
## ~-max.Accuracy.OOB - max.AUCROCR.OOB - max.AUCpROC.OOB + min.elapsedtime.everything -
## max.Accuracy.fit - opt.prob.threshold.OOB
## <environment: 0x7f9d39351a70>
## [1] "Best model id: Low.cor.X##rcv#glmnet"
## [1] "User specified selection: All.X##rcv#glmnet"
## glmnet
##
## 1966 samples
## 109 predictor
## 2 classes: 'D', 'R'
##
## No pre-processing
## Resampling: Cross-Validated (3 fold, repeated 3 times)
## Summary of sample sizes: 1312, 1310, 1310, 1311, 1310, 1311, ...
## Resampling results across tuning parameters:
##
## alpha lambda Accuracy Kappa
## 0.100 7.416788e-05 0.5474840 0.06197487
## 0.100 3.442568e-04 0.5490089 0.06467607
## 0.100 1.597898e-03 0.5508731 0.06647164
## 0.100 7.416788e-03 0.5625743 0.08698028
## 0.100 3.442568e-02 0.5851208 0.12212690
## 0.325 7.416788e-05 0.5479929 0.06296942
## 0.325 3.442568e-04 0.5490091 0.06417522
## 0.325 1.597898e-03 0.5518909 0.06828571
## 0.325 7.416788e-03 0.5691867 0.09707201
## 0.325 3.442568e-02 0.5973221 0.12972600
## 0.550 7.416788e-05 0.5471450 0.06126057
## 0.550 3.442568e-04 0.5486688 0.06326212
## 0.550 1.597898e-03 0.5571480 0.07825962
## 0.550 7.416788e-03 0.5763070 0.10839764
## 0.550 3.442568e-02 0.6037574 0.13070637
## 0.775 7.416788e-05 0.5466361 0.06014652
## 0.775 3.442568e-04 0.5483301 0.06236174
## 0.775 1.597898e-03 0.5593512 0.08239904
## 0.775 7.416788e-03 0.5829179 0.11697026
## 0.775 3.442568e-02 0.6010474 0.11261152
## 1.000 7.416788e-05 0.5462968 0.05933642
## 1.000 3.442568e-04 0.5486683 0.06265923
## 1.000 1.597898e-03 0.5632500 0.08857402
## 1.000 7.416788e-03 0.5902107 0.12691893
## 1.000 3.442568e-02 0.5895150 0.06872935
##
## Accuracy was used to select the optimal model using the largest value.
## The final values used for the model were alpha = 0.55 and lambda
## = 0.03442568.
## [1] "All.X##rcv#glmnet fit prediction diagnostics:"
## [1] "All.X##rcv#glmnet OOB prediction diagnostics:"
## All.X..rcv.glmnet.imp imp
## Hhold.fctrPKn 100.0000000 100.0000000
## Q115611.fctrNo 74.8310371 74.8310371
## Q113181.fctrNo 71.9217479 71.9217479
## Q115611.fctrYes 70.4290930 70.4290930
## Q98869.fctrNo 66.6128974 66.6128974
## Q101163.fctrDad 62.4655160 62.4655160
## Q113181.fctrYes 55.5170996 55.5170996
## Q116881.fctrRight 49.4278917 49.4278917
## Q99480.fctrNo 43.2534158 43.2534158
## Q109244.fctrNo:.clusterid.fctr2 39.5589149 39.5589149
## Q98197.fctrYes 30.2889588 30.2889588
## Q120472.fctrScience 28.6966467 28.6966467
## Hhold.fctrPKy 27.2269256 27.2269256
## Q108855.fctrYes! 20.8545071 20.8545071
## Q106272.fctrNo 20.6694877 20.6694877
## Q110740.fctrPC 20.2380396 20.2380396
## Q98197.fctrNo 16.4908495 16.4908495
## YOB.Age.fctr^6 15.7172616 15.7172616
## Hhold.fctrMKy 15.1524950 15.1524950
## Q116953.fctrNo 14.7571499 14.7571499
## Q115899.fctrCs 8.2575355 8.2575355
## Q116881.fctrHappy 6.1528740 6.1528740
## Q120379.fctrNo 4.1519631 4.1519631
## Q106997.fctrYy 4.0717791 4.0717791
## Q115195.fctrYes 0.7006634 0.7006634
## Q120379.fctrYes 0.0718631 0.0718631
## .rnorm 0.0000000 0.0000000
## Edn.fctr.L 0.0000000 0.0000000
## Edn.fctr.Q 0.0000000 0.0000000
## Edn.fctr.C 0.0000000 0.0000000
## Edn.fctr^4 0.0000000 0.0000000
## Edn.fctr^5 0.0000000 0.0000000
## Edn.fctr^6 0.0000000 0.0000000
## Edn.fctr^7 0.0000000 0.0000000
## Gender.fctrF 0.0000000 0.0000000
## Gender.fctrM 0.0000000 0.0000000
## Hhold.fctrMKn 0.0000000 0.0000000
## Hhold.fctrSKn 0.0000000 0.0000000
## Hhold.fctrSKy 0.0000000 0.0000000
## Income.fctr.L 0.0000000 0.0000000
## Income.fctr.Q 0.0000000 0.0000000
## Income.fctr.C 0.0000000 0.0000000
## Income.fctr^4 0.0000000 0.0000000
## Income.fctr^5 0.0000000 0.0000000
## Income.fctr^6 0.0000000 0.0000000
## Q100010.fctrNo 0.0000000 0.0000000
## Q100010.fctrYes 0.0000000 0.0000000
## Q100562.fctrNo 0.0000000 0.0000000
## Q100562.fctrYes 0.0000000 0.0000000
## Q100680.fctrNo 0.0000000 0.0000000
## Q100680.fctrYes 0.0000000 0.0000000
## Q100689.fctrNo 0.0000000 0.0000000
## Q100689.fctrYes 0.0000000 0.0000000
## Q101162.fctrOptimist 0.0000000 0.0000000
## Q101162.fctrPessimist 0.0000000 0.0000000
## Q101163.fctrMom 0.0000000 0.0000000
## Q101596.fctrNo 0.0000000 0.0000000
## Q101596.fctrYes 0.0000000 0.0000000
## Q102089.fctrOwn 0.0000000 0.0000000
## Q102089.fctrRent 0.0000000 0.0000000
## Q102289.fctrNo 0.0000000 0.0000000
## Q102289.fctrYes 0.0000000 0.0000000
## Q102674.fctrNo 0.0000000 0.0000000
## Q102674.fctrYes 0.0000000 0.0000000
## Q102687.fctrNo 0.0000000 0.0000000
## Q102687.fctrYes 0.0000000 0.0000000
## Q102906.fctrNo 0.0000000 0.0000000
## Q102906.fctrYes 0.0000000 0.0000000
## Q103293.fctrNo 0.0000000 0.0000000
## Q103293.fctrYes 0.0000000 0.0000000
## Q104996.fctrNo 0.0000000 0.0000000
## Q104996.fctrYes 0.0000000 0.0000000
## Q105655.fctrNo 0.0000000 0.0000000
## Q105655.fctrYes 0.0000000 0.0000000
## Q105840.fctrNo 0.0000000 0.0000000
## Q105840.fctrYes 0.0000000 0.0000000
## Q106042.fctrNo 0.0000000 0.0000000
## Q106042.fctrYes 0.0000000 0.0000000
## Q106272.fctrYes 0.0000000 0.0000000
## Q106388.fctrNo 0.0000000 0.0000000
## Q106388.fctrYes 0.0000000 0.0000000
## Q106389.fctrNo 0.0000000 0.0000000
## Q106389.fctrYes 0.0000000 0.0000000
## Q106993.fctrNo 0.0000000 0.0000000
## Q106993.fctrYes 0.0000000 0.0000000
## Q106997.fctrGr 0.0000000 0.0000000
## Q107491.fctrNo 0.0000000 0.0000000
## Q107491.fctrYes 0.0000000 0.0000000
## Q107869.fctrNo 0.0000000 0.0000000
## Q107869.fctrYes 0.0000000 0.0000000
## Q108342.fctrIn-person 0.0000000 0.0000000
## Q108342.fctrOnline 0.0000000 0.0000000
## Q108343.fctrNo 0.0000000 0.0000000
## Q108343.fctrYes 0.0000000 0.0000000
## Q108617.fctrNo 0.0000000 0.0000000
## Q108617.fctrYes 0.0000000 0.0000000
## Q108754.fctrNo 0.0000000 0.0000000
## Q108754.fctrYes 0.0000000 0.0000000
## Q108855.fctrUmm... 0.0000000 0.0000000
## Q108856.fctrSocialize 0.0000000 0.0000000
## Q108856.fctrSpace 0.0000000 0.0000000
## Q108950.fctrCautious 0.0000000 0.0000000
## Q108950.fctrRisk-friendly 0.0000000 0.0000000
## Q109367.fctrNo 0.0000000 0.0000000
## Q109367.fctrYes 0.0000000 0.0000000
## Q110740.fctrMac 0.0000000 0.0000000
## Q111220.fctrNo 0.0000000 0.0000000
## Q111220.fctrYes 0.0000000 0.0000000
## Q111580.fctrDemanding 0.0000000 0.0000000
## Q111580.fctrSupportive 0.0000000 0.0000000
## Q111848.fctrNo 0.0000000 0.0000000
## Q111848.fctrYes 0.0000000 0.0000000
## Q112270.fctrNo 0.0000000 0.0000000
## Q112270.fctrYes 0.0000000 0.0000000
## Q112478.fctrNo 0.0000000 0.0000000
## Q112478.fctrYes 0.0000000 0.0000000
## Q112512.fctrNo 0.0000000 0.0000000
## Q112512.fctrYes 0.0000000 0.0000000
## Q113583.fctrTalk 0.0000000 0.0000000
## Q113583.fctrTunes 0.0000000 0.0000000
## Q113584.fctrPeople 0.0000000 0.0000000
## Q113584.fctrTechnology 0.0000000 0.0000000
## Q113992.fctrNo 0.0000000 0.0000000
## Q113992.fctrYes 0.0000000 0.0000000
## Q114152.fctrNo 0.0000000 0.0000000
## Q114152.fctrYes 0.0000000 0.0000000
## Q114386.fctrMysterious 0.0000000 0.0000000
## Q114386.fctrTMI 0.0000000 0.0000000
## Q114517.fctrNo 0.0000000 0.0000000
## Q114517.fctrYes 0.0000000 0.0000000
## Q114748.fctrNo 0.0000000 0.0000000
## Q114748.fctrYes 0.0000000 0.0000000
## Q114961.fctrNo 0.0000000 0.0000000
## Q114961.fctrYes 0.0000000 0.0000000
## Q115195.fctrNo 0.0000000 0.0000000
## Q115390.fctrNo 0.0000000 0.0000000
## Q115390.fctrYes 0.0000000 0.0000000
## Q115602.fctrNo 0.0000000 0.0000000
## Q115602.fctrYes 0.0000000 0.0000000
## Q115610.fctrNo 0.0000000 0.0000000
## Q115610.fctrYes 0.0000000 0.0000000
## Q115777.fctrEnd 0.0000000 0.0000000
## Q115777.fctrStart 0.0000000 0.0000000
## Q115899.fctrMe 0.0000000 0.0000000
## Q116197.fctrA.M. 0.0000000 0.0000000
## Q116197.fctrP.M. 0.0000000 0.0000000
## Q116441.fctrNo 0.0000000 0.0000000
## Q116441.fctrYes 0.0000000 0.0000000
## Q116448.fctrNo 0.0000000 0.0000000
## Q116448.fctrYes 0.0000000 0.0000000
## Q116601.fctrNo 0.0000000 0.0000000
## Q116601.fctrYes 0.0000000 0.0000000
## Q116797.fctrNo 0.0000000 0.0000000
## Q116797.fctrYes 0.0000000 0.0000000
## Q116953.fctrYes 0.0000000 0.0000000
## Q117186.fctrCool headed 0.0000000 0.0000000
## Q117186.fctrHot headed 0.0000000 0.0000000
## Q117193.fctrOdd hours 0.0000000 0.0000000
## Q117193.fctrStandard hours 0.0000000 0.0000000
## Q118117.fctrNo 0.0000000 0.0000000
## Q118117.fctrYes 0.0000000 0.0000000
## Q118232.fctrId 0.0000000 0.0000000
## Q118232.fctrPr 0.0000000 0.0000000
## Q118233.fctrNo 0.0000000 0.0000000
## Q118233.fctrYes 0.0000000 0.0000000
## Q118237.fctrNo 0.0000000 0.0000000
## Q118237.fctrYes 0.0000000 0.0000000
## Q118892.fctrNo 0.0000000 0.0000000
## Q118892.fctrYes 0.0000000 0.0000000
## Q119334.fctrNo 0.0000000 0.0000000
## Q119334.fctrYes 0.0000000 0.0000000
## Q119650.fctrGiving 0.0000000 0.0000000
## Q119650.fctrReceiving 0.0000000 0.0000000
## Q119851.fctrNo 0.0000000 0.0000000
## Q119851.fctrYes 0.0000000 0.0000000
## Q120012.fctrNo 0.0000000 0.0000000
## Q120012.fctrYes 0.0000000 0.0000000
## Q120014.fctrNo 0.0000000 0.0000000
## Q120014.fctrYes 0.0000000 0.0000000
## Q120194.fctrStudy first 0.0000000 0.0000000
## Q120194.fctrTry first 0.0000000 0.0000000
## Q120472.fctrArt 0.0000000 0.0000000
## Q120650.fctrNo 0.0000000 0.0000000
## Q120650.fctrYes 0.0000000 0.0000000
## Q120978.fctrNo 0.0000000 0.0000000
## Q120978.fctrYes 0.0000000 0.0000000
## Q121011.fctrNo 0.0000000 0.0000000
## Q121011.fctrYes 0.0000000 0.0000000
## Q121699.fctrNo 0.0000000 0.0000000
## Q121699.fctrYes 0.0000000 0.0000000
## Q121700.fctrNo 0.0000000 0.0000000
## Q121700.fctrYes 0.0000000 0.0000000
## Q122120.fctrNo 0.0000000 0.0000000
## Q122120.fctrYes 0.0000000 0.0000000
## Q122769.fctrNo 0.0000000 0.0000000
## Q122769.fctrYes 0.0000000 0.0000000
## Q122770.fctrNo 0.0000000 0.0000000
## Q122770.fctrYes 0.0000000 0.0000000
## Q122771.fctrPc 0.0000000 0.0000000
## Q122771.fctrPt 0.0000000 0.0000000
## Q123464.fctrNo 0.0000000 0.0000000
## Q123464.fctrYes 0.0000000 0.0000000
## Q123621.fctrNo 0.0000000 0.0000000
## Q123621.fctrYes 0.0000000 0.0000000
## Q124122.fctrNo 0.0000000 0.0000000
## Q124122.fctrYes 0.0000000 0.0000000
## Q124742.fctrNo 0.0000000 0.0000000
## Q124742.fctrYes 0.0000000 0.0000000
## Q96024.fctrNo 0.0000000 0.0000000
## Q96024.fctrYes 0.0000000 0.0000000
## Q98059.fctrOnly-child 0.0000000 0.0000000
## Q98059.fctrYes 0.0000000 0.0000000
## Q98078.fctrNo 0.0000000 0.0000000
## Q98078.fctrYes 0.0000000 0.0000000
## Q98578.fctrNo 0.0000000 0.0000000
## Q98578.fctrYes 0.0000000 0.0000000
## Q98869.fctrYes 0.0000000 0.0000000
## Q99480.fctrYes 0.0000000 0.0000000
## Q99581.fctrNo 0.0000000 0.0000000
## Q99581.fctrYes 0.0000000 0.0000000
## Q99716.fctrNo 0.0000000 0.0000000
## Q99716.fctrYes 0.0000000 0.0000000
## Q99982.fctrCheck! 0.0000000 0.0000000
## Q99982.fctrNope 0.0000000 0.0000000
## YOB.Age.fctr.L 0.0000000 0.0000000
## YOB.Age.fctr.Q 0.0000000 0.0000000
## YOB.Age.fctr.C 0.0000000 0.0000000
## YOB.Age.fctr^4 0.0000000 0.0000000
## YOB.Age.fctr^5 0.0000000 0.0000000
## YOB.Age.fctr^7 0.0000000 0.0000000
## YOB.Age.fctr^8 0.0000000 0.0000000
## Q109244.fctrNA:.clusterid.fctr1 0.0000000 0.0000000
## Q109244.fctrNo:.clusterid.fctr1 0.0000000 0.0000000
## Q109244.fctrYes:.clusterid.fctr1 0.0000000 0.0000000
## Q109244.fctrNA:.clusterid.fctr2 0.0000000 0.0000000
## Q109244.fctrYes:.clusterid.fctr2 0.0000000 0.0000000
## Q109244.fctrNA:.clusterid.fctr3 0.0000000 0.0000000
## Q109244.fctrNo:.clusterid.fctr3 0.0000000 0.0000000
## Q109244.fctrYes:.clusterid.fctr3 0.0000000 0.0000000
## YOB.Age.fctrNA:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(15,20]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(20,25]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(25,30]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(30,35]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(35,40]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(40,50]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(50,65]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(65,90]:YOB.Age.dff 0.0000000 0.0000000
## Warning in glb_analytics_diag_plots(obs_df = glbObsOOB, mdl_id =
## glbMdlSelId, : Limiting important feature scatter plots to 5 out of 108
## [1] "Min/Max Boundaries: "
## [1] "Inaccurate: "
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 1 470 R 0.3781065
## 2 2226 R 0.3976514
## 3 493 R 0.4089913
## 4 2051 R 0.4100291
## 5 4042 R 0.4157935
## 6 3082 R 0.4183314
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 1 D TRUE
## 2 D TRUE
## 3 D TRUE
## 4 D TRUE
## 5 D TRUE
## 6 D TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs Party.fctr.All.X..rcv.glmnet.is.acc
## 1 0.6218935 FALSE
## 2 0.6023486 FALSE
## 3 0.5910087 FALSE
## 4 0.5899709 FALSE
## 5 0.5842065 FALSE
## 6 0.5816686 FALSE
## Party.fctr.All.X..rcv.glmnet.accurate Party.fctr.All.X..rcv.glmnet.error
## 1 FALSE -0.07189353
## 2 FALSE -0.05234860
## 3 FALSE -0.04100873
## 4 FALSE -0.03997085
## 5 FALSE -0.03420648
## 6 FALSE -0.03166862
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 5 4042 R 0.4157935
## 14 32 R 0.4417232
## 114 4156 D 0.5770600
## 118 4084 D 0.5835408
## 128 1140 D 0.5906073
## 188 2369 D 0.6854429
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 5 D TRUE
## 14 D TRUE
## 114 R TRUE
## 118 R TRUE
## 128 R TRUE
## 188 R TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs
## 5 0.5842065
## 14 0.5582768
## 114 0.5770600
## 118 0.5835408
## 128 0.5906073
## 188 0.6854429
## Party.fctr.All.X..rcv.glmnet.is.acc
## 5 FALSE
## 14 FALSE
## 114 FALSE
## 118 FALSE
## 128 FALSE
## 188 FALSE
## Party.fctr.All.X..rcv.glmnet.accurate
## 5 FALSE
## 14 FALSE
## 114 FALSE
## 118 FALSE
## 128 FALSE
## 188 FALSE
## Party.fctr.All.X..rcv.glmnet.error
## 5 -0.034206477
## 14 -0.008276834
## 114 0.127059950
## 118 0.133540782
## 128 0.140607326
## 188 0.235442940
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 198 853 D 0.7160185
## 199 3625 D 0.7183170
## 200 1339 D 0.7222690
## 201 217 D 0.7229525
## 202 1992 D 0.7236406
## 203 613 D 0.7283414
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 198 R TRUE
## 199 R TRUE
## 200 R TRUE
## 201 R TRUE
## 202 R TRUE
## 203 R TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs
## 198 0.7160185
## 199 0.7183170
## 200 0.7222690
## 201 0.7229525
## 202 0.7236406
## 203 0.7283414
## Party.fctr.All.X..rcv.glmnet.is.acc
## 198 FALSE
## 199 FALSE
## 200 FALSE
## 201 FALSE
## 202 FALSE
## 203 FALSE
## Party.fctr.All.X..rcv.glmnet.accurate
## 198 FALSE
## 199 FALSE
## 200 FALSE
## 201 FALSE
## 202 FALSE
## 203 FALSE
## Party.fctr.All.X..rcv.glmnet.error
## 198 0.2660185
## 199 0.2683170
## 200 0.2722690
## 201 0.2729525
## 202 0.2736406
## 203 0.2783414
## Q109244.fctr .n.OOB .n.Fit .n.Tst .freqRatio.Fit .freqRatio.OOB
## No No 493 1966 622 1 1
## .freqRatio.Tst err.abs.fit.sum err.abs.fit.mean .n.fit err.abs.OOB.sum
## No 1 914.5756 0.4651961 1966 234.7403
## err.abs.OOB.mean
## No 0.4761466
## .n.OOB .n.Fit .n.Tst .freqRatio.Fit
## 493.0000000 1966.0000000 622.0000000 1.0000000
## .freqRatio.OOB .freqRatio.Tst err.abs.fit.sum err.abs.fit.mean
## 1.0000000 1.0000000 914.5755991 0.4651961
## .n.fit err.abs.OOB.sum err.abs.OOB.mean
## 1966.0000000 234.7402522 0.4761466
## label step_major step_minor label_minor bgn end elapsed
## 1 fit.models_2_bgn 1 0 teardown 430.22 NA NA
## label step_major step_minor label_minor bgn end elapsed
## 18 fit.models 8 2 2 421.026 430.229 9.203
## 19 fit.models 8 3 3 430.230 NA NA
# if (sum(is.na(glbObsAll$D.P.http)) > 0)
# stop("fit.models_3: Why is this happening ?")
#stop(here"); glb2Sav()
sync_glb_obs_df <- function() {
# Merge or cbind ?
for (col in setdiff(names(glbObsFit), names(glbObsTrn)))
glbObsTrn[glbObsTrn$.lcn == "Fit", col] <<- glbObsFit[, col]
for (col in setdiff(names(glbObsFit), names(glbObsAll)))
glbObsAll[glbObsAll$.lcn == "Fit", col] <<- glbObsFit[, col]
if (all(is.na(glbObsNew[, glb_rsp_var])))
for (col in setdiff(names(glbObsOOB), names(glbObsTrn)))
glbObsTrn[glbObsTrn$.lcn == "OOB", col] <<- glbObsOOB[, col]
for (col in setdiff(names(glbObsOOB), names(glbObsAll)))
glbObsAll[glbObsAll$.lcn == "OOB", col] <<- glbObsOOB[, col]
}
sync_glb_obs_df()
print(setdiff(names(glbObsNew), names(glbObsAll)))
## character(0)
replay.petrisim(pn = glb_analytics_pn,
replay.trans = (glb_analytics_avl_objs <- c(glb_analytics_avl_objs,
"model.selected")), flip_coord = TRUE)
## time trans "bgn " "fit.data.training.all " "predict.data.new " "end "
## 0.0000 multiple enabled transitions: data.training.all data.new model.selected firing: data.training.all
## 1.0000 1 2 1 0 0
## 1.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction firing: data.new
## 2.0000 2 1 1 1 0
## 2.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction data.new.prediction firing: model.selected
## 3.0000 3 0 2 1 0
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.data.training", major.inc = TRUE)
## label step_major step_minor label_minor bgn end
## 19 fit.models 8 3 3 430.230 433.296
## 20 fit.data.training 9 0 0 433.297 NA
## elapsed
## 19 3.067
## 20 NA
9.0: fit data training#load(paste0(glb_inp_pfx, "dsk.RData"))
if (!is.null(glbMdlFinId) && (glbMdlFinId %in% names(glb_models_lst))) {
warning("Final model same as user selected model")
glb_fin_mdl <- glb_models_lst[[glbMdlFinId]]
} else
# if (nrow(glbObsFit) + length(glbObsFitOutliers) == nrow(glbObsTrn))
if (!all(is.na(glbObsNew[, glb_rsp_var]))) {
warning("Final model same as glbMdlSelId")
glbMdlFinId <- paste0("Final.", glbMdlSelId)
glb_fin_mdl <- glb_sel_mdl
glb_models_lst[[glbMdlFinId]] <- glb_fin_mdl
mdlDf <- glb_models_df[glb_models_df$id == glbMdlSelId, ]
mdlDf$id <- glbMdlFinId
glb_models_df <- rbind(glb_models_df, mdlDf)
} else {
if (myparseMdlId(glbMdlSelId)$family == "RFE.X") {
indepVar <- mygetIndepVar(glb_feats_df)
trnRFEResults <-
myrun_rfe(glbObsTrn, indepVar, glbRFESizes[["Final"]])
if (!isTRUE(all.equal(sort(predictors(trnRFEResults)),
sort(predictors(glbRFEResults))))) {
print("Diffs predictors(trnRFEResults) vs. predictors(glbRFEResults):")
print(setdiff(predictors(trnRFEResults), predictors(glbRFEResults)))
print("Diffs predictors(glbRFEResults) vs. predictors(trnRFEResults):")
print(setdiff(predictors(glbRFEResults), predictors(trnRFEResults)))
}
}
if (grepl("Ensemble", glbMdlSelId)) {
# Find which models are relevant
mdlimp_df <- subset(myget_feats_importance(glb_sel_mdl), imp > 5)
mdlIndepVar <- row.names(mdlimp_df)
if (glb_is_classification)
mdlIdVcr <- glbMdlEnsemble[sapply(glbMdlEnsemble, function(thsMdlId)
mygetPredictIds(glb_rsp_var, thsMdlId)$prob %in% mdlIndepVar)] else
mdlIdVcr <- glbMdlEnsemble[sapply(glbMdlEnsemble, function(thsMdlId)
mygetPredictIds(glb_rsp_var, thsMdlId)$value %in% mdlIndepVar)]
# Fit selected models on glbObsTrn
for (mdl_id in mdlIdVcr) {
mdl_id_components <- myparseMdlId(mdl_id)
mdlIdPfx <- mdl_id_components$family
# if (grepl("RFE\\.X\\.", mdlIdPfx))
# mdlIndepVars <- myadjustInteractionFeats(glb_feats_df, myextract_actual_feats(
# predictors(trnRFEResults))) else
# mdlIndepVars <- trim(unlist(
# strsplit(glb_models_df[glb_models_df$id == mdl_id, "feats"], "[,]")))
thsIndepVar <- unlist(
strsplit(glb_models_df[glb_models_df$id == mdl_id, "feats"], "[,]"))
thsSpc <- myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = paste0("Final.", mdlIdPfx),
type = glb_model_type, tune.df = glbMdlTuneParams,
trainControl.method = mdl_id_components$resample,
trainControl.number = glb_rcv_n_folds,
trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = mdl_id_components$alg,
train.preProcess = mdl_id_components$preProcess))
ret_lst <- myfit_mdl(mdl_specs_lst = thsSpc,
indepVar = thsIndepVar,
rsp_var = glb_rsp_var,
fit_df = glbObsTrn, OOB_df = NULL)
glbObsTrn <- glb_get_predictions(df = glbObsTrn,
mdl_id = thsSpc$id,
rsp_var = glb_rsp_var,
prob_threshold_def =
subset(glb_models_df, id == mdl_id)$opt.prob.threshold.OOB)
glbObsNew <- glb_get_predictions(df = glbObsNew,
mdl_id = thsSpc$id,
rsp_var = glb_rsp_var,
prob_threshold_def =
subset(glb_models_df, id == mdl_id)$opt.prob.threshold.OOB)
}
}
# "Final" model
if ((model_method <- glb_sel_mdl$method) == "custom")
# get actual method from the mdl_id
model_method <- tail(unlist(strsplit(glbMdlSelId, "[.]")), 1)
if (grepl("Ensemble", glbMdlSelId)) {
# Find which models are relevant
mdlimp_df <- subset(myget_feats_importance(glb_sel_mdl), imp > 5)
mdlIndepVar <- row.names(mdlimp_df)
if (glb_is_classification)
mdlIdVcr <- glbMdlEnsemble[sapply(glbMdlEnsemble, function(thsMdlId)
mygetPredictIds(glb_rsp_var, thsMdlId)$prob %in% mdlIndepVar)] else
mdlIdVcr <- glbMdlEnsemble[sapply(glbMdlEnsemble, function(thsMdlId)
mygetPredictIds(glb_rsp_var, thsMdlId)$value %in% mdlIndepVar)]
mdlIdVcr <- paste("Final", mdlIdVcr, sep = ".")
mdlIndepVar <- gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"), mdlIndepVar, fixed = TRUE)
# if (glb_is_classification && glb_is_binomial)
# indepVar <- gsub("(.*)\\.(.*)\\.prob", "\\1\\.Train\\.\\2\\.prob",
# row.names(mdlimp_df)) else
# indepVar <- gsub("(.*)\\.(.*)", "\\1\\.Train\\.\\2",
# row.names(mdlimp_df))
} else
if (grepl("RFE.X", glbMdlSelId, fixed = TRUE)) {
# indepVar <- myextract_actual_feats(predictors(trnRFEResults))
mdlIndepVar <- myextract_actual_feats(predictors(glbRFEResults))
} else mdlIndepVar <-
trim(unlist(strsplit(glb_models_df[glb_models_df$id ==
glbMdlSelId
, "feats"], "[,]")))
# if (!is.null(glbMdlPreprocMethods) &&
# ((match_pos <- regexpr(gsub(".", "\\.",
# paste(glbMdlPreprocMethods, collapse = "|"),
# fixed = TRUE), glbMdlSelId)) != -1))
# ths_preProcess <- str_sub(glbMdlSelId, match_pos,
# match_pos + attr(match_pos, "match.length") - 1) else
# ths_preProcess <- NULL
# mdl_id_pfx <- ifelse(grepl("Ensemble", glbMdlSelId),
# "Final.Ensemble", "Final")
thsMdlId <- paste0("Final.", glbMdlSelId)
thsMdlIdComponents <- myparseMdlId(thsMdlId)
# mdl_id_pfx <- paste("Final", myparseMdlId(glbMdlSelId)$family, sep = ".")
mdl_id_pfx <- thsMdlIdComponents$family
trnobs_df <- glbObsTrn
if (!is.null(glbObsTrnOutliers[[mdl_id_pfx]])) {
trnobs_df <- glbObsTrn[!(glbObsTrn[, glbFeatsId] %in% glbObsTrnOutliers[[mdl_id_pfx]]), ]
print(sprintf("Outliers removed: %d", nrow(glbObsTrn) - nrow(trnobs_df)))
print(setdiff(glbObsTrn[, glbFeatsId], trnobs_df[, glbFeatsId]))
}
# Force fitting of Final.glm to identify outliers
# method_vctr <- unique(c(myparseMdlId(glbMdlSelId)$alg, glbMdlFamilies[["Final"]]))
thsSpc <- myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = mdl_id_pfx,
type = glb_model_type, tune.df = glbMdlTuneParams,
trainControl.method = thsMdlIdComponents$resample,
trainControl.number = glb_rcv_n_folds,
trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = thsMdlIdComponents$alg,
train.preProcess = thsMdlIdComponents$preProcess))
glbMdlFinId <- thsSpc$id
if (!(grepl("Ensemble", glbMdlSelId)))
ret_lst <- myfit_mdl(mdl_specs_lst = thsSpc,
indepVar = mdlIndepVar,
rsp_var = glb_rsp_var,
fit_df = glbObsTrn, OOB_df = NULL) else {
# Final model same as selected model except for the model features
tmp_models_df <- glb_models_df[glb_models_df$id == glbMdlSelId, ]
tmp_models_df$id <- paste0("Final.", tmp_models_df$id)
row.names(tmp_models_df) <- tmp_models_df$id
tmp_models_df$feats <- gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
tmp_models_df$feats, fixed = TRUE)
glb_models_df <- rbind(glb_models_df, tmp_models_df)
tmp_fin_mdl <- glb_sel_mdl
# tmp_fin_mdl$coefnames <- gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
# tmp_fin_mdl$coefnames, fixed = TRUE)
# dimnames(tmp_fin_mdl$finalModel$beta)[[1]] <-
# gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
# dimnames(tmp_fin_mdl$finalModel$beta)[[1]], fixed = TRUE)
# tmp_fin_mdl$finalModel$xNames <-
# gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
# tmp_fin_mdl$finalModel$xNames, fixed = TRUE)
#
# thsAts <- attributes(tmp_fin_mdl$terms)
# # thsAts$variables <- class == "call" & objects / symbols are stored as a formula
# thsAts$term.labels <-
# gsub(glb_rsp_var, paste0(glb_rsp_var, ".Final"),
# thsAts$term.labels, fixed = TRUE)
# attributes(tmp_fin_mdl$terms) <- thsAts
#
glb_models_lst[[glbMdlFinId]] <- tmp_fin_mdl
}
glb_fin_mdl <- glb_models_lst[[glbMdlFinId]]
}
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "myfit_mdl: fitting model: Final.All.X##rcv#glmnet"
## [1] " indepVar: Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr"
## [1] "myfit_mdl: setup complete: 0.684000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.0316 on full training set
## [1] "myfit_mdl: train complete: 18.633000 secs"
## Warning in myfit_mdl(mdl_specs_lst = thsSpc, indepVar = mdlIndepVar,
## rsp_var = glb_rsp_var, : model's bestTune found at an extreme of tuneGrid
## for parameter: lambda
## Length Class Mode
## a0 75 -none- numeric
## beta 18600 dgCMatrix S4
## df 75 -none- numeric
## dim 2 -none- numeric
## lambda 75 -none- numeric
## dev.ratio 75 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 248 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) Hhold.fctrMKy
## 0.2970169682 0.0513665757
## Hhold.fctrPKn Hhold.fctrPKy
## -0.2838557632 -0.0008998049
## Income.fctr.Q Q100562.fctrNo
## 0.0291344589 -0.0080125635
## Q101163.fctrDad Q106272.fctrNo
## 0.1186987147 -0.0270178645
## Q106997.fctrGr Q108855.fctrYes!
## 0.0517027973 0.0392115902
## Q110740.fctrPC Q113181.fctrNo
## 0.0627772273 -0.1712567515
## Q113181.fctrYes Q115611.fctrNo
## 0.0673416516 -0.1001127511
## Q115611.fctrYes Q116881.fctrRight
## 0.2275131539 0.1642609924
## Q98197.fctrNo Q98869.fctrNo
## -0.1712736620 -0.1059987327
## Q99480.fctrNo Q109244.fctrNo:.clusterid.fctr2
## -0.0661417738 -0.0723266563
## [1] "max lambda < lambdaOpt:"
## (Intercept) Hhold.fctrMKy
## 0.288708416 0.060678421
## Hhold.fctrPKn Hhold.fctrPKy
## -0.318837645 -0.067999748
## Income.fctr.Q Income.fctr^6
## 0.047659160 -0.004784633
## Q100562.fctrNo Q101163.fctrDad
## -0.028077170 0.129505996
## Q106272.fctrNo Q106997.fctrGr
## -0.038375513 0.071350406
## Q108855.fctrYes! Q110740.fctrPC
## 0.051707657 0.075505834
## Q113181.fctrNo Q113181.fctrYes
## -0.178368468 0.066189401
## Q115611.fctrNo Q115611.fctrYes
## -0.106296095 0.229654922
## Q115899.fctrCs Q116881.fctrHappy
## -0.009884619 -0.003625296
## Q116881.fctrRight Q116953.fctrNo
## 0.174080150 0.007503033
## Q118232.fctrId Q120472.fctrScience
## -0.004865184 0.010983305
## Q122120.fctrNo Q98197.fctrNo
## -0.005886664 -0.177014715
## Q98869.fctrNo Q99480.fctrNo
## -0.120044949 -0.077426499
## Q109244.fctrNo:.clusterid.fctr2 YOB.Age.fctr(35,40]:YOB.Age.dff
## -0.073202658 -0.004835400
## [1] "myfit_mdl: train diagnostics complete: 19.306000 secs"
## Prediction
## Reference D R
## D 485 553
## R 379 1042
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.209841e-01 2.051659e-01 6.014708e-01 6.402089e-01 5.778772e-01
## AccuracyPValue McnemarPValue
## 7.486567e-06 1.454861e-08
## [1] "myfit_mdl: predict complete: 25.729000 secs"
## id
## 1 Final.All.X##rcv#glmnet
## feats
## 1 Q115611.fctr,Q113181.fctr,Q98197.fctr,Q116881.fctr,Q108855.fctr,Q106272.fctr,Q122771.fctr,Q123621.fctr,Q106388.fctr,Q110740.fctr,Q122769.fctr,Q120472.fctr,Q101596.fctr,Q119334.fctr,Q114152.fctr,Q98869.fctr,Q115899.fctr,Q116797.fctr,Q118232.fctr,Gender.fctr,Q105655.fctr,Q99480.fctr,Q123464.fctr,Q120650.fctr,Q122120.fctr,Q107869.fctr,Q120014.fctr,Q102289.fctr,Income.fctr,Q122770.fctr,Q111580.fctr,Q116601.fctr,Q117186.fctr,Q106993.fctr,Q112270.fctr,Q101162.fctr,Q108856.fctr,Q117193.fctr,Q116441.fctr,Q119851.fctr,Q111848.fctr,Q98578.fctr,Q118892.fctr,Q114386.fctr,Q120978.fctr,Q112512.fctr,Q102674.fctr,Q96024.fctr,Q108950.fctr,Q115610.fctr,YOB.Age.fctr,Q112478.fctr,Q116197.fctr,Q124742.fctr,Q106389.fctr,Edn.fctr,Q118117.fctr,Q100562.fctr,Q107491.fctr,Q116448.fctr,Q108754.fctr,Q116953.fctr,Q115602.fctr,Q118233.fctr,Q120012.fctr,Q118237.fctr,Q99581.fctr,.rnorm,Q120194.fctr,Q115777.fctr,Q106997.fctr,Q100680.fctr,Q113584.fctr,Q108343.fctr,Q121700.fctr,Q105840.fctr,Q120379.fctr,Q103293.fctr,Q124122.fctr,Q109367.fctr,Q113992.fctr,Q121699.fctr,Q121011.fctr,Q114748.fctr,Q106042.fctr,Q111220.fctr,Q114517.fctr,Q102687.fctr,Q102906.fctr,Q98078.fctr,Q115390.fctr,Q102089.fctr,Q100010.fctr,Q99982.fctr,Q113583.fctr,Q108342.fctr,Q104996.fctr,Q119650.fctr,Q100689.fctr,Q108617.fctr,Q115195.fctr,Q99716.fctr,Q101163.fctr,Q98059.fctr,Q114961.fctr,Hhold.fctr,YOB.Age.fctr:YOB.Age.dff,Q109244.fctr:.clusterid.fctr
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 25 17.861 1.628
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.5729879 0.2909441 0.8550317 0.6490527
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.55 0.6909814 0.597397
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.6014708 0.6402089 0.1121178
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.01441578 0.02911097
## [1] "myfit_mdl: exit: 25.752000 secs"
rm(ret_lst)
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.data.training", major.inc=FALSE)
## label step_major step_minor label_minor bgn end
## 20 fit.data.training 9 0 0 433.297 459.565
## 21 fit.data.training 9 1 1 459.566 NA
## elapsed
## 20 26.268
## 21 NA
#stop(here"); glb2Sav()
if (glb_is_classification && glb_is_binomial)
prob_threshold <- glb_models_df[glb_models_df$id == glbMdlSelId,
"opt.prob.threshold.OOB"] else
prob_threshold <- NULL
if (grepl("Ensemble", glbMdlFinId)) {
# Get predictions for each model in ensemble; Outliers that have been moved to OOB might not have been predicted yet
mdlEnsembleComps <- unlist(str_split(subset(glb_models_df,
id == glbMdlFinId)$feats, ","))
if (glb_is_classification)
# mdlEnsembleComps <- gsub("\\.prob$", "", mdlEnsembleComps)
# mdlEnsembleComps <- gsub(paste0("^",
# gsub(".", "\\.", mygetPredictIds(glb_rsp_var)$value, fixed = TRUE)),
# "", mdlEnsembleComps)
mdlEnsembleComps <- glb_models_df$id[sapply(glb_models_df$id, function(thsMdlId)
mygetPredictIds(glb_rsp_var, thsMdlId)$prob %in% mdlEnsembleComps)] else
mdlEnsembleComps <- glb_models_df$id[sapply(glb_models_df$id, function(thsMdlId)
mygetPredictIds(glb_rsp_var, thsMdlId)$value %in% mdlEnsembleComps)]
for (mdl_id in mdlEnsembleComps) {
glbObsTrn <- glb_get_predictions(df = glbObsTrn, mdl_id = mdl_id,
rsp_var = glb_rsp_var,
prob_threshold_def = prob_threshold)
glbObsNew <- glb_get_predictions(df = glbObsNew, mdl_id = mdl_id,
rsp_var = glb_rsp_var,
prob_threshold_def = prob_threshold)
# glb_fin_mdl uses the same coefficients as glb_sel_mdl,
# so copy the "Final" columns into "non-Final" columns
glbObsTrn[, gsub("Final.", "", unlist(mygetPredictIds(glb_rsp_var, mdl_id)))] <-
glbObsTrn[, unlist(mygetPredictIds(glb_rsp_var, mdl_id))]
glbObsNew[, gsub("Final.", "", unlist(mygetPredictIds(glb_rsp_var, mdl_id)))] <-
glbObsNew[, unlist(mygetPredictIds(glb_rsp_var, mdl_id))]
}
}
glbObsTrn <- glb_get_predictions(df = glbObsTrn, mdl_id = glbMdlFinId,
rsp_var = glb_rsp_var,
prob_threshold_def = prob_threshold)
## Warning in glb_get_predictions(df = glbObsTrn, mdl_id = glbMdlFinId,
## rsp_var = glb_rsp_var, : Using default probability threshold: 0.45
glb_featsimp_df <- myget_feats_importance(mdl=glb_fin_mdl,
featsimp_df=glb_featsimp_df)
#glb_featsimp_df[, paste0(glbMdlFinId, ".imp")] <- glb_featsimp_df$imp
print(glb_featsimp_df)
## All.X..rcv.glmnet.imp
## Hhold.fctrPKn 100.0000000
## Q115611.fctrYes 70.4290930
## Q113181.fctrNo 71.9217479
## Q98197.fctrNo 16.4908495
## Q116881.fctrRight 49.4278917
## Q101163.fctrDad 62.4655160
## Q98869.fctrNo 66.6128974
## Q115611.fctrNo 74.8310371
## Q109244.fctrNo:.clusterid.fctr2 39.5589149
## Q99480.fctrNo 43.2534158
## Q110740.fctrPC 20.2380396
## Q113181.fctrYes 55.5170996
## Q106997.fctrGr 0.0000000
## Hhold.fctrMKy 15.1524950
## Q108855.fctrYes! 20.8545071
## Income.fctr.Q 0.0000000
## Hhold.fctrPKy 27.2269256
## Q106272.fctrNo 20.6694877
## Q100562.fctrNo 0.0000000
## Q120472.fctrScience 28.6966467
## Q115899.fctrCs 8.2575355
## Q116953.fctrNo 14.7571499
## Q122120.fctrNo 0.0000000
## Q118232.fctrId 0.0000000
## YOB.Age.fctr(35,40]:YOB.Age.dff 0.0000000
## Income.fctr^6 0.0000000
## Q116881.fctrHappy 6.1528740
## .rnorm 0.0000000
## Edn.fctr.C 0.0000000
## Edn.fctr.L 0.0000000
## Edn.fctr.Q 0.0000000
## Edn.fctr^4 0.0000000
## Edn.fctr^5 0.0000000
## Edn.fctr^6 0.0000000
## Edn.fctr^7 0.0000000
## Gender.fctrF 0.0000000
## Gender.fctrM 0.0000000
## Hhold.fctrMKn 0.0000000
## Hhold.fctrSKn 0.0000000
## Hhold.fctrSKy 0.0000000
## Income.fctr.C 0.0000000
## Income.fctr.L 0.0000000
## Income.fctr^4 0.0000000
## Income.fctr^5 0.0000000
## Q100010.fctrNo 0.0000000
## Q100010.fctrYes 0.0000000
## Q100562.fctrYes 0.0000000
## Q100680.fctrNo 0.0000000
## Q100680.fctrYes 0.0000000
## Q100689.fctrNo 0.0000000
## Q100689.fctrYes 0.0000000
## Q101162.fctrOptimist 0.0000000
## Q101162.fctrPessimist 0.0000000
## Q101163.fctrMom 0.0000000
## Q101596.fctrNo 0.0000000
## Q101596.fctrYes 0.0000000
## Q102089.fctrOwn 0.0000000
## Q102089.fctrRent 0.0000000
## Q102289.fctrNo 0.0000000
## Q102289.fctrYes 0.0000000
## Q102674.fctrNo 0.0000000
## Q102674.fctrYes 0.0000000
## Q102687.fctrNo 0.0000000
## Q102687.fctrYes 0.0000000
## Q102906.fctrNo 0.0000000
## Q102906.fctrYes 0.0000000
## Q103293.fctrNo 0.0000000
## Q103293.fctrYes 0.0000000
## Q104996.fctrNo 0.0000000
## Q104996.fctrYes 0.0000000
## Q105655.fctrNo 0.0000000
## Q105655.fctrYes 0.0000000
## Q105840.fctrNo 0.0000000
## Q105840.fctrYes 0.0000000
## Q106042.fctrNo 0.0000000
## Q106042.fctrYes 0.0000000
## Q106272.fctrYes 0.0000000
## Q106388.fctrNo 0.0000000
## Q106388.fctrYes 0.0000000
## Q106389.fctrNo 0.0000000
## Q106389.fctrYes 0.0000000
## Q106993.fctrNo 0.0000000
## Q106993.fctrYes 0.0000000
## Q106997.fctrYy 4.0717791
## Q107491.fctrNo 0.0000000
## Q107491.fctrYes 0.0000000
## Q107869.fctrNo 0.0000000
## Q107869.fctrYes 0.0000000
## Q108342.fctrIn-person 0.0000000
## Q108342.fctrOnline 0.0000000
## Q108343.fctrNo 0.0000000
## Q108343.fctrYes 0.0000000
## Q108617.fctrNo 0.0000000
## Q108617.fctrYes 0.0000000
## Q108754.fctrNo 0.0000000
## Q108754.fctrYes 0.0000000
## Q108855.fctrUmm... 0.0000000
## Q108856.fctrSocialize 0.0000000
## Q108856.fctrSpace 0.0000000
## Q108950.fctrCautious 0.0000000
## Q108950.fctrRisk-friendly 0.0000000
## Q109244.fctrNA:.clusterid.fctr1 0.0000000
## Q109244.fctrNA:.clusterid.fctr2 0.0000000
## Q109244.fctrNA:.clusterid.fctr3 0.0000000
## Q109244.fctrNo:.clusterid.fctr1 0.0000000
## Q109244.fctrNo:.clusterid.fctr3 0.0000000
## Q109244.fctrYes:.clusterid.fctr1 0.0000000
## Q109244.fctrYes:.clusterid.fctr2 0.0000000
## Q109244.fctrYes:.clusterid.fctr3 0.0000000
## Q109367.fctrNo 0.0000000
## Q109367.fctrYes 0.0000000
## Q110740.fctrMac 0.0000000
## Q111220.fctrNo 0.0000000
## Q111220.fctrYes 0.0000000
## Q111580.fctrDemanding 0.0000000
## Q111580.fctrSupportive 0.0000000
## Q111848.fctrNo 0.0000000
## Q111848.fctrYes 0.0000000
## Q112270.fctrNo 0.0000000
## Q112270.fctrYes 0.0000000
## Q112478.fctrNo 0.0000000
## Q112478.fctrYes 0.0000000
## Q112512.fctrNo 0.0000000
## Q112512.fctrYes 0.0000000
## Q113583.fctrTalk 0.0000000
## Q113583.fctrTunes 0.0000000
## Q113584.fctrPeople 0.0000000
## Q113584.fctrTechnology 0.0000000
## Q113992.fctrNo 0.0000000
## Q113992.fctrYes 0.0000000
## Q114152.fctrNo 0.0000000
## Q114152.fctrYes 0.0000000
## Q114386.fctrMysterious 0.0000000
## Q114386.fctrTMI 0.0000000
## Q114517.fctrNo 0.0000000
## Q114517.fctrYes 0.0000000
## Q114748.fctrNo 0.0000000
## Q114748.fctrYes 0.0000000
## Q114961.fctrNo 0.0000000
## Q114961.fctrYes 0.0000000
## Q115195.fctrNo 0.0000000
## Q115195.fctrYes 0.7006634
## Q115390.fctrNo 0.0000000
## Q115390.fctrYes 0.0000000
## Q115602.fctrNo 0.0000000
## Q115602.fctrYes 0.0000000
## Q115610.fctrNo 0.0000000
## Q115610.fctrYes 0.0000000
## Q115777.fctrEnd 0.0000000
## Q115777.fctrStart 0.0000000
## Q115899.fctrMe 0.0000000
## Q116197.fctrA.M. 0.0000000
## Q116197.fctrP.M. 0.0000000
## Q116441.fctrNo 0.0000000
## Q116441.fctrYes 0.0000000
## Q116448.fctrNo 0.0000000
## Q116448.fctrYes 0.0000000
## Q116601.fctrNo 0.0000000
## Q116601.fctrYes 0.0000000
## Q116797.fctrNo 0.0000000
## Q116797.fctrYes 0.0000000
## Q116953.fctrYes 0.0000000
## Q117186.fctrCool headed 0.0000000
## Q117186.fctrHot headed 0.0000000
## Q117193.fctrOdd hours 0.0000000
## Q117193.fctrStandard hours 0.0000000
## Q118117.fctrNo 0.0000000
## Q118117.fctrYes 0.0000000
## Q118232.fctrPr 0.0000000
## Q118233.fctrNo 0.0000000
## Q118233.fctrYes 0.0000000
## Q118237.fctrNo 0.0000000
## Q118237.fctrYes 0.0000000
## Q118892.fctrNo 0.0000000
## Q118892.fctrYes 0.0000000
## Q119334.fctrNo 0.0000000
## Q119334.fctrYes 0.0000000
## Q119650.fctrGiving 0.0000000
## Q119650.fctrReceiving 0.0000000
## Q119851.fctrNo 0.0000000
## Q119851.fctrYes 0.0000000
## Q120012.fctrNo 0.0000000
## Q120012.fctrYes 0.0000000
## Q120014.fctrNo 0.0000000
## Q120014.fctrYes 0.0000000
## Q120194.fctrStudy first 0.0000000
## Q120194.fctrTry first 0.0000000
## Q120379.fctrNo 4.1519631
## Q120379.fctrYes 0.0718631
## Q120472.fctrArt 0.0000000
## Q120650.fctrNo 0.0000000
## Q120650.fctrYes 0.0000000
## Q120978.fctrNo 0.0000000
## Q120978.fctrYes 0.0000000
## Q121011.fctrNo 0.0000000
## Q121011.fctrYes 0.0000000
## Q121699.fctrNo 0.0000000
## Q121699.fctrYes 0.0000000
## Q121700.fctrNo 0.0000000
## Q121700.fctrYes 0.0000000
## Q122120.fctrYes 0.0000000
## Q122769.fctrNo 0.0000000
## Q122769.fctrYes 0.0000000
## Q122770.fctrNo 0.0000000
## Q122770.fctrYes 0.0000000
## Q122771.fctrPc 0.0000000
## Q122771.fctrPt 0.0000000
## Q123464.fctrNo 0.0000000
## Q123464.fctrYes 0.0000000
## Q123621.fctrNo 0.0000000
## Q123621.fctrYes 0.0000000
## Q124122.fctrNo 0.0000000
## Q124122.fctrYes 0.0000000
## Q124742.fctrNo 0.0000000
## Q124742.fctrYes 0.0000000
## Q96024.fctrNo 0.0000000
## Q96024.fctrYes 0.0000000
## Q98059.fctrOnly-child 0.0000000
## Q98059.fctrYes 0.0000000
## Q98078.fctrNo 0.0000000
## Q98078.fctrYes 0.0000000
## Q98197.fctrYes 30.2889588
## Q98578.fctrNo 0.0000000
## Q98578.fctrYes 0.0000000
## Q98869.fctrYes 0.0000000
## Q99480.fctrYes 0.0000000
## Q99581.fctrNo 0.0000000
## Q99581.fctrYes 0.0000000
## Q99716.fctrNo 0.0000000
## Q99716.fctrYes 0.0000000
## Q99982.fctrCheck! 0.0000000
## Q99982.fctrNope 0.0000000
## YOB.Age.fctr(15,20]:YOB.Age.dff 0.0000000
## YOB.Age.fctr(20,25]:YOB.Age.dff 0.0000000
## YOB.Age.fctr(25,30]:YOB.Age.dff 0.0000000
## YOB.Age.fctr(30,35]:YOB.Age.dff 0.0000000
## YOB.Age.fctr(40,50]:YOB.Age.dff 0.0000000
## YOB.Age.fctr(50,65]:YOB.Age.dff 0.0000000
## YOB.Age.fctr(65,90]:YOB.Age.dff 0.0000000
## YOB.Age.fctr.C 0.0000000
## YOB.Age.fctr.L 0.0000000
## YOB.Age.fctr.Q 0.0000000
## YOB.Age.fctrNA:YOB.Age.dff 0.0000000
## YOB.Age.fctr^4 0.0000000
## YOB.Age.fctr^5 0.0000000
## YOB.Age.fctr^6 15.7172616
## YOB.Age.fctr^7 0.0000000
## YOB.Age.fctr^8 0.0000000
## Final.All.X..rcv.glmnet.imp imp
## Hhold.fctrPKn 100.0000000 100.0000000
## Q115611.fctrYes 75.9584309 75.9584309
## Q113181.fctrNo 58.0668000 58.0668000
## Q98197.fctrNo 57.8505154 57.8505154
## Q116881.fctrRight 56.1801537 56.1801537
## Q101163.fctrDad 41.1979661 41.1979661
## Q98869.fctrNo 37.5016257 37.5016257
## Q115611.fctrNo 34.2725138 34.2725138
## Q109244.fctrNo:.clusterid.fctr2 24.1788511 24.1788511
## Q99480.fctrNo 23.8084963 23.8084963
## Q110740.fctrPC 22.9240816 22.9240816
## Q113181.fctrYes 22.1937700 22.1937700
## Q106997.fctrGr 20.3637641 20.3637641
## Hhold.fctrMKy 18.5787083 18.5787083
## Q108855.fctrYes! 15.0546341 15.0546341
## Income.fctr.Q 12.6816120 12.6816120
## Hhold.fctrPKy 11.1622362 11.1622362
## Q106272.fctrNo 10.8178681 10.8178681
## Q100562.fctrNo 5.9112686 5.9112686
## Q120472.fctrScience 1.7781504 1.7781504
## Q115899.fctrCs 1.6002778 1.6002778
## Q116953.fctrNo 1.2147091 1.2147091
## Q122120.fctrNo 0.9530258 0.9530258
## Q118232.fctrId 0.7876526 0.7876526
## YOB.Age.fctr(35,40]:YOB.Age.dff 0.7828307 0.7828307
## Income.fctr^6 0.7746117 0.7746117
## Q116881.fctrHappy 0.5869200 0.5869200
## .rnorm 0.0000000 0.0000000
## Edn.fctr.C 0.0000000 0.0000000
## Edn.fctr.L 0.0000000 0.0000000
## Edn.fctr.Q 0.0000000 0.0000000
## Edn.fctr^4 0.0000000 0.0000000
## Edn.fctr^5 0.0000000 0.0000000
## Edn.fctr^6 0.0000000 0.0000000
## Edn.fctr^7 0.0000000 0.0000000
## Gender.fctrF 0.0000000 0.0000000
## Gender.fctrM 0.0000000 0.0000000
## Hhold.fctrMKn 0.0000000 0.0000000
## Hhold.fctrSKn 0.0000000 0.0000000
## Hhold.fctrSKy 0.0000000 0.0000000
## Income.fctr.C 0.0000000 0.0000000
## Income.fctr.L 0.0000000 0.0000000
## Income.fctr^4 0.0000000 0.0000000
## Income.fctr^5 0.0000000 0.0000000
## Q100010.fctrNo 0.0000000 0.0000000
## Q100010.fctrYes 0.0000000 0.0000000
## Q100562.fctrYes 0.0000000 0.0000000
## Q100680.fctrNo 0.0000000 0.0000000
## Q100680.fctrYes 0.0000000 0.0000000
## Q100689.fctrNo 0.0000000 0.0000000
## Q100689.fctrYes 0.0000000 0.0000000
## Q101162.fctrOptimist 0.0000000 0.0000000
## Q101162.fctrPessimist 0.0000000 0.0000000
## Q101163.fctrMom 0.0000000 0.0000000
## Q101596.fctrNo 0.0000000 0.0000000
## Q101596.fctrYes 0.0000000 0.0000000
## Q102089.fctrOwn 0.0000000 0.0000000
## Q102089.fctrRent 0.0000000 0.0000000
## Q102289.fctrNo 0.0000000 0.0000000
## Q102289.fctrYes 0.0000000 0.0000000
## Q102674.fctrNo 0.0000000 0.0000000
## Q102674.fctrYes 0.0000000 0.0000000
## Q102687.fctrNo 0.0000000 0.0000000
## Q102687.fctrYes 0.0000000 0.0000000
## Q102906.fctrNo 0.0000000 0.0000000
## Q102906.fctrYes 0.0000000 0.0000000
## Q103293.fctrNo 0.0000000 0.0000000
## Q103293.fctrYes 0.0000000 0.0000000
## Q104996.fctrNo 0.0000000 0.0000000
## Q104996.fctrYes 0.0000000 0.0000000
## Q105655.fctrNo 0.0000000 0.0000000
## Q105655.fctrYes 0.0000000 0.0000000
## Q105840.fctrNo 0.0000000 0.0000000
## Q105840.fctrYes 0.0000000 0.0000000
## Q106042.fctrNo 0.0000000 0.0000000
## Q106042.fctrYes 0.0000000 0.0000000
## Q106272.fctrYes 0.0000000 0.0000000
## Q106388.fctrNo 0.0000000 0.0000000
## Q106388.fctrYes 0.0000000 0.0000000
## Q106389.fctrNo 0.0000000 0.0000000
## Q106389.fctrYes 0.0000000 0.0000000
## Q106993.fctrNo 0.0000000 0.0000000
## Q106993.fctrYes 0.0000000 0.0000000
## Q106997.fctrYy 0.0000000 0.0000000
## Q107491.fctrNo 0.0000000 0.0000000
## Q107491.fctrYes 0.0000000 0.0000000
## Q107869.fctrNo 0.0000000 0.0000000
## Q107869.fctrYes 0.0000000 0.0000000
## Q108342.fctrIn-person 0.0000000 0.0000000
## Q108342.fctrOnline 0.0000000 0.0000000
## Q108343.fctrNo 0.0000000 0.0000000
## Q108343.fctrYes 0.0000000 0.0000000
## Q108617.fctrNo 0.0000000 0.0000000
## Q108617.fctrYes 0.0000000 0.0000000
## Q108754.fctrNo 0.0000000 0.0000000
## Q108754.fctrYes 0.0000000 0.0000000
## Q108855.fctrUmm... 0.0000000 0.0000000
## Q108856.fctrSocialize 0.0000000 0.0000000
## Q108856.fctrSpace 0.0000000 0.0000000
## Q108950.fctrCautious 0.0000000 0.0000000
## Q108950.fctrRisk-friendly 0.0000000 0.0000000
## Q109244.fctrNA:.clusterid.fctr1 0.0000000 0.0000000
## Q109244.fctrNA:.clusterid.fctr2 0.0000000 0.0000000
## Q109244.fctrNA:.clusterid.fctr3 0.0000000 0.0000000
## Q109244.fctrNo:.clusterid.fctr1 0.0000000 0.0000000
## Q109244.fctrNo:.clusterid.fctr3 0.0000000 0.0000000
## Q109244.fctrYes:.clusterid.fctr1 0.0000000 0.0000000
## Q109244.fctrYes:.clusterid.fctr2 0.0000000 0.0000000
## Q109244.fctrYes:.clusterid.fctr3 0.0000000 0.0000000
## Q109367.fctrNo 0.0000000 0.0000000
## Q109367.fctrYes 0.0000000 0.0000000
## Q110740.fctrMac 0.0000000 0.0000000
## Q111220.fctrNo 0.0000000 0.0000000
## Q111220.fctrYes 0.0000000 0.0000000
## Q111580.fctrDemanding 0.0000000 0.0000000
## Q111580.fctrSupportive 0.0000000 0.0000000
## Q111848.fctrNo 0.0000000 0.0000000
## Q111848.fctrYes 0.0000000 0.0000000
## Q112270.fctrNo 0.0000000 0.0000000
## Q112270.fctrYes 0.0000000 0.0000000
## Q112478.fctrNo 0.0000000 0.0000000
## Q112478.fctrYes 0.0000000 0.0000000
## Q112512.fctrNo 0.0000000 0.0000000
## Q112512.fctrYes 0.0000000 0.0000000
## Q113583.fctrTalk 0.0000000 0.0000000
## Q113583.fctrTunes 0.0000000 0.0000000
## Q113584.fctrPeople 0.0000000 0.0000000
## Q113584.fctrTechnology 0.0000000 0.0000000
## Q113992.fctrNo 0.0000000 0.0000000
## Q113992.fctrYes 0.0000000 0.0000000
## Q114152.fctrNo 0.0000000 0.0000000
## Q114152.fctrYes 0.0000000 0.0000000
## Q114386.fctrMysterious 0.0000000 0.0000000
## Q114386.fctrTMI 0.0000000 0.0000000
## Q114517.fctrNo 0.0000000 0.0000000
## Q114517.fctrYes 0.0000000 0.0000000
## Q114748.fctrNo 0.0000000 0.0000000
## Q114748.fctrYes 0.0000000 0.0000000
## Q114961.fctrNo 0.0000000 0.0000000
## Q114961.fctrYes 0.0000000 0.0000000
## Q115195.fctrNo 0.0000000 0.0000000
## Q115195.fctrYes 0.0000000 0.0000000
## Q115390.fctrNo 0.0000000 0.0000000
## Q115390.fctrYes 0.0000000 0.0000000
## Q115602.fctrNo 0.0000000 0.0000000
## Q115602.fctrYes 0.0000000 0.0000000
## Q115610.fctrNo 0.0000000 0.0000000
## Q115610.fctrYes 0.0000000 0.0000000
## Q115777.fctrEnd 0.0000000 0.0000000
## Q115777.fctrStart 0.0000000 0.0000000
## Q115899.fctrMe 0.0000000 0.0000000
## Q116197.fctrA.M. 0.0000000 0.0000000
## Q116197.fctrP.M. 0.0000000 0.0000000
## Q116441.fctrNo 0.0000000 0.0000000
## Q116441.fctrYes 0.0000000 0.0000000
## Q116448.fctrNo 0.0000000 0.0000000
## Q116448.fctrYes 0.0000000 0.0000000
## Q116601.fctrNo 0.0000000 0.0000000
## Q116601.fctrYes 0.0000000 0.0000000
## Q116797.fctrNo 0.0000000 0.0000000
## Q116797.fctrYes 0.0000000 0.0000000
## Q116953.fctrYes 0.0000000 0.0000000
## Q117186.fctrCool headed 0.0000000 0.0000000
## Q117186.fctrHot headed 0.0000000 0.0000000
## Q117193.fctrOdd hours 0.0000000 0.0000000
## Q117193.fctrStandard hours 0.0000000 0.0000000
## Q118117.fctrNo 0.0000000 0.0000000
## Q118117.fctrYes 0.0000000 0.0000000
## Q118232.fctrPr 0.0000000 0.0000000
## Q118233.fctrNo 0.0000000 0.0000000
## Q118233.fctrYes 0.0000000 0.0000000
## Q118237.fctrNo 0.0000000 0.0000000
## Q118237.fctrYes 0.0000000 0.0000000
## Q118892.fctrNo 0.0000000 0.0000000
## Q118892.fctrYes 0.0000000 0.0000000
## Q119334.fctrNo 0.0000000 0.0000000
## Q119334.fctrYes 0.0000000 0.0000000
## Q119650.fctrGiving 0.0000000 0.0000000
## Q119650.fctrReceiving 0.0000000 0.0000000
## Q119851.fctrNo 0.0000000 0.0000000
## Q119851.fctrYes 0.0000000 0.0000000
## Q120012.fctrNo 0.0000000 0.0000000
## Q120012.fctrYes 0.0000000 0.0000000
## Q120014.fctrNo 0.0000000 0.0000000
## Q120014.fctrYes 0.0000000 0.0000000
## Q120194.fctrStudy first 0.0000000 0.0000000
## Q120194.fctrTry first 0.0000000 0.0000000
## Q120379.fctrNo 0.0000000 0.0000000
## Q120379.fctrYes 0.0000000 0.0000000
## Q120472.fctrArt 0.0000000 0.0000000
## Q120650.fctrNo 0.0000000 0.0000000
## Q120650.fctrYes 0.0000000 0.0000000
## Q120978.fctrNo 0.0000000 0.0000000
## Q120978.fctrYes 0.0000000 0.0000000
## Q121011.fctrNo 0.0000000 0.0000000
## Q121011.fctrYes 0.0000000 0.0000000
## Q121699.fctrNo 0.0000000 0.0000000
## Q121699.fctrYes 0.0000000 0.0000000
## Q121700.fctrNo 0.0000000 0.0000000
## Q121700.fctrYes 0.0000000 0.0000000
## Q122120.fctrYes 0.0000000 0.0000000
## Q122769.fctrNo 0.0000000 0.0000000
## Q122769.fctrYes 0.0000000 0.0000000
## Q122770.fctrNo 0.0000000 0.0000000
## Q122770.fctrYes 0.0000000 0.0000000
## Q122771.fctrPc 0.0000000 0.0000000
## Q122771.fctrPt 0.0000000 0.0000000
## Q123464.fctrNo 0.0000000 0.0000000
## Q123464.fctrYes 0.0000000 0.0000000
## Q123621.fctrNo 0.0000000 0.0000000
## Q123621.fctrYes 0.0000000 0.0000000
## Q124122.fctrNo 0.0000000 0.0000000
## Q124122.fctrYes 0.0000000 0.0000000
## Q124742.fctrNo 0.0000000 0.0000000
## Q124742.fctrYes 0.0000000 0.0000000
## Q96024.fctrNo 0.0000000 0.0000000
## Q96024.fctrYes 0.0000000 0.0000000
## Q98059.fctrOnly-child 0.0000000 0.0000000
## Q98059.fctrYes 0.0000000 0.0000000
## Q98078.fctrNo 0.0000000 0.0000000
## Q98078.fctrYes 0.0000000 0.0000000
## Q98197.fctrYes 0.0000000 0.0000000
## Q98578.fctrNo 0.0000000 0.0000000
## Q98578.fctrYes 0.0000000 0.0000000
## Q98869.fctrYes 0.0000000 0.0000000
## Q99480.fctrYes 0.0000000 0.0000000
## Q99581.fctrNo 0.0000000 0.0000000
## Q99581.fctrYes 0.0000000 0.0000000
## Q99716.fctrNo 0.0000000 0.0000000
## Q99716.fctrYes 0.0000000 0.0000000
## Q99982.fctrCheck! 0.0000000 0.0000000
## Q99982.fctrNope 0.0000000 0.0000000
## YOB.Age.fctr(15,20]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(20,25]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(25,30]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(30,35]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(40,50]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(50,65]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr(65,90]:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr.C 0.0000000 0.0000000
## YOB.Age.fctr.L 0.0000000 0.0000000
## YOB.Age.fctr.Q 0.0000000 0.0000000
## YOB.Age.fctrNA:YOB.Age.dff 0.0000000 0.0000000
## YOB.Age.fctr^4 0.0000000 0.0000000
## YOB.Age.fctr^5 0.0000000 0.0000000
## YOB.Age.fctr^6 0.0000000 0.0000000
## YOB.Age.fctr^7 0.0000000 0.0000000
## YOB.Age.fctr^8 0.0000000 0.0000000
if (glb_is_classification && glb_is_binomial)
glb_analytics_diag_plots(obs_df=glbObsTrn, mdl_id=glbMdlFinId,
prob_threshold=glb_models_df[glb_models_df$id == glbMdlSelId,
"opt.prob.threshold.OOB"]) else
glb_analytics_diag_plots(obs_df=glbObsTrn, mdl_id=glbMdlFinId)
## Warning in glb_analytics_diag_plots(obs_df = glbObsTrn, mdl_id =
## glbMdlFinId, : Limiting important feature scatter plots to 5 out of 108
## [1] "Min/Max Boundaries: "
## [1] "Inaccurate: "
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 1 5879 R 0.3726079
## 2 26 R 0.3732665
## 3 599 R 0.3873659
## 4 470 R NA
## 5 403 R 0.3926555
## 6 1610 R 0.4161595
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 1 D TRUE
## 2 D TRUE
## 3 D TRUE
## 4 <NA> NA
## 5 D TRUE
## 6 D TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs Party.fctr.All.X..rcv.glmnet.is.acc
## 1 0.6273921 FALSE
## 2 0.6267335 FALSE
## 3 0.6126341 FALSE
## 4 NA NA
## 5 0.6073445 FALSE
## 6 0.5838405 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.prob
## 1 0.3676277
## 2 0.3726328
## 3 0.3915592
## 4 0.3923804
## 5 0.3977130
## 6 0.3981271
## Party.fctr.Final.All.X..rcv.glmnet
## 1 D
## 2 D
## 3 D
## 4 D
## 5 D
## 6 D
## Party.fctr.Final.All.X..rcv.glmnet.err
## 1 TRUE
## 2 TRUE
## 3 TRUE
## 4 TRUE
## 5 TRUE
## 6 TRUE
## Party.fctr.Final.All.X..rcv.glmnet.err.abs
## 1 0.6323723
## 2 0.6273672
## 3 0.6084408
## 4 0.6076196
## 5 0.6022870
## 6 0.6018729
## Party.fctr.Final.All.X..rcv.glmnet.is.acc
## 1 FALSE
## 2 FALSE
## 3 FALSE
## 4 FALSE
## 5 FALSE
## 6 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.accurate
## 1 FALSE
## 2 FALSE
## 3 FALSE
## 4 FALSE
## 5 FALSE
## 6 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.error
## 1 -0.08237233
## 2 -0.07736717
## 3 -0.05844080
## 4 -0.05761956
## 5 -0.05228705
## 6 -0.05187289
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 22 2533 R 0.4279397
## 41 4737 R 0.4548967
## 482 5951 D 0.5586695
## 512 2447 D 0.5671780
## 578 5229 D NA
## 989 943 D 0.7140905
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 22 D TRUE
## 41 R FALSE
## 482 R TRUE
## 512 R TRUE
## 578 <NA> NA
## 989 R TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs
## 22 0.5720603
## 41 0.5451033
## 482 0.5586695
## 512 0.5671780
## 578 NA
## 989 0.7140905
## Party.fctr.All.X..rcv.glmnet.is.acc
## 22 FALSE
## 41 TRUE
## 482 FALSE
## 512 FALSE
## 578 NA
## 989 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.prob
## 22 0.4345395
## 41 0.4474682
## 482 0.5556392
## 512 0.5612856
## 578 0.5727992
## 989 0.7151865
## Party.fctr.Final.All.X..rcv.glmnet
## 22 D
## 41 D
## 482 R
## 512 R
## 578 R
## 989 R
## Party.fctr.Final.All.X..rcv.glmnet.err
## 22 TRUE
## 41 TRUE
## 482 TRUE
## 512 TRUE
## 578 TRUE
## 989 TRUE
## Party.fctr.Final.All.X..rcv.glmnet.err.abs
## 22 0.5654605
## 41 0.5525318
## 482 0.5556392
## 512 0.5612856
## 578 0.5727992
## 989 0.7151865
## Party.fctr.Final.All.X..rcv.glmnet.is.acc
## 22 FALSE
## 41 FALSE
## 482 FALSE
## 512 FALSE
## 578 FALSE
## 989 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.accurate
## 22 FALSE
## 41 FALSE
## 482 FALSE
## 512 FALSE
## 578 FALSE
## 989 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.error
## 22 -0.015460479
## 41 -0.002531803
## 482 0.105639209
## 512 0.111285591
## 578 0.122799196
## 989 0.265186481
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 1000 2641 D 0.7109417
## 1001 78 D 0.7237733
## 1002 4956 D 0.7264982
## 1003 3474 D 0.7430687
## 1004 1309 D 0.7395013
## 1005 3578 D 0.7389856
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 1000 R TRUE
## 1001 R TRUE
## 1002 R TRUE
## 1003 R TRUE
## 1004 R TRUE
## 1005 R TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs
## 1000 0.7109417
## 1001 0.7237733
## 1002 0.7264982
## 1003 0.7430687
## 1004 0.7395013
## 1005 0.7389856
## Party.fctr.All.X..rcv.glmnet.is.acc
## 1000 FALSE
## 1001 FALSE
## 1002 FALSE
## 1003 FALSE
## 1004 FALSE
## 1005 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.prob
## 1000 0.7258532
## 1001 0.7347881
## 1002 0.7348269
## 1003 0.7375263
## 1004 0.7446751
## 1005 0.7482297
## Party.fctr.Final.All.X..rcv.glmnet
## 1000 R
## 1001 R
## 1002 R
## 1003 R
## 1004 R
## 1005 R
## Party.fctr.Final.All.X..rcv.glmnet.err
## 1000 TRUE
## 1001 TRUE
## 1002 TRUE
## 1003 TRUE
## 1004 TRUE
## 1005 TRUE
## Party.fctr.Final.All.X..rcv.glmnet.err.abs
## 1000 0.7258532
## 1001 0.7347881
## 1002 0.7348269
## 1003 0.7375263
## 1004 0.7446751
## 1005 0.7482297
## Party.fctr.Final.All.X..rcv.glmnet.is.acc
## 1000 FALSE
## 1001 FALSE
## 1002 FALSE
## 1003 FALSE
## 1004 FALSE
## 1005 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.accurate
## 1000 FALSE
## 1001 FALSE
## 1002 FALSE
## 1003 FALSE
## 1004 FALSE
## 1005 FALSE
## Party.fctr.Final.All.X..rcv.glmnet.error
## 1000 0.2758532
## 1001 0.2847881
## 1002 0.2848269
## 1003 0.2875263
## 1004 0.2946751
## 1005 0.2982297
dsp_feats_vctr <- c(NULL)
for(var in grep(".imp", names(glb_feats_df), fixed=TRUE, value=TRUE))
dsp_feats_vctr <- union(dsp_feats_vctr,
glb_feats_df[!is.na(glb_feats_df[, var]), "id"])
# print(glbObsTrn[glbObsTrn$UniqueID %in% FN_OOB_ids,
# grep(glb_rsp_var, names(glbObsTrn), value=TRUE)])
print(setdiff(names(glbObsTrn), names(glbObsAll)))
## [1] "Party.fctr.Final.All.X..rcv.glmnet.prob"
## [2] "Party.fctr.Final.All.X..rcv.glmnet"
## [3] "Party.fctr.Final.All.X..rcv.glmnet.err"
## [4] "Party.fctr.Final.All.X..rcv.glmnet.err.abs"
## [5] "Party.fctr.Final.All.X..rcv.glmnet.is.acc"
for (col in setdiff(names(glbObsTrn), names(glbObsAll)))
# Merge or cbind ?
glbObsAll[glbObsAll$.src == "Train", col] <- glbObsTrn[, col]
print(setdiff(names(glbObsFit), names(glbObsAll)))
## character(0)
print(setdiff(names(glbObsOOB), names(glbObsAll)))
## character(0)
for (col in setdiff(names(glbObsOOB), names(glbObsAll)))
# Merge or cbind ?
glbObsAll[glbObsAll$.lcn == "OOB", col] <- glbObsOOB[, col]
print(setdiff(names(glbObsNew), names(glbObsAll)))
## character(0)
#glb2Sav(); all.equal(savObsAll, glbObsAll); all.equal(sav_models_lst, glb_models_lst)
#load(file = paste0(glbOut$pfx, "dsk_knitr.RData"))
#cmpCols <- names(glbObsAll)[!grepl("\\.Final\\.", names(glbObsAll))]; all.equal(savObsAll[, cmpCols], glbObsAll[, cmpCols]); all.equal(savObsAll[, "H.P.http"], glbObsAll[, "H.P.http"]);
replay.petrisim(pn = glb_analytics_pn,
replay.trans = (glb_analytics_avl_objs <- c(glb_analytics_avl_objs,
"data.training.all.prediction","model.final")), flip_coord = TRUE)
## time trans "bgn " "fit.data.training.all " "predict.data.new " "end "
## 0.0000 multiple enabled transitions: data.training.all data.new model.selected firing: data.training.all
## 1.0000 1 2 1 0 0
## 1.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction firing: data.new
## 2.0000 2 1 1 1 0
## 2.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction data.new.prediction firing: model.selected
## 3.0000 3 0 2 1 0
## 3.0000 multiple enabled transitions: model.final data.training.all.prediction data.new.prediction firing: data.training.all.prediction
## 4.0000 5 0 1 1 1
## 4.0000 multiple enabled transitions: model.final data.training.all.prediction data.new.prediction firing: model.final
## 5.0000 4 0 0 2 1
glb_chunks_df <- myadd_chunk(glb_chunks_df, "predict.data.new", major.inc = TRUE)
## label step_major step_minor label_minor bgn end
## 21 fit.data.training 9 1 1 459.566 466.883
## 22 predict.data.new 10 0 0 466.884 NA
## elapsed
## 21 7.318
## 22 NA
10.0: predict data new## Warning in glb_get_predictions(obs_df, mdl_id = glbMdlFinId, rsp_var =
## glb_rsp_var, : Using default probability threshold: 0.45
## Warning in glb_get_predictions(obs_df, mdl_id = glbMdlFinId, rsp_var =
## glb_rsp_var, : Using default probability threshold: 0.45
## Warning in glb_analytics_diag_plots(obs_df = glbObsNew, mdl_id =
## glbMdlFinId, : Limiting important feature scatter plots to 5 out of 108
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## Warning: Removed 622 rows containing missing values (geom_point).
## NULL
## [1] "OOBobs total range outliers: 0"
## [1] "newobs total range outliers: 0"
## [1] "Stacking file Votes_Ensemble_cnk06_out_fin.csv to prediction outputs..."
## [1] 0.45
## [1] "glbMdlSelId: All.X##rcv#glmnet"
## [1] "glbMdlFinId: Final.All.X##rcv#glmnet"
## [1] "Cross Validation issues:"
## MFO###myMFO_classfr Random###myrandom_classfr
## 0 0
## Max.cor.Y.rcv.1X1###glmnet
## 0
## max.Accuracy.OOB max.AUCROCR.OOB
## Low.cor.X##rcv#glmnet 0.5882353 0.5838394
## All.X##rcv#glmnet 0.5882353 0.5838394
## All.X##rcv#glm 0.5841785 0.5436235
## Max.cor.Y.rcv.1X1###glmnet 0.5780933 0.5660003
## Interact.High.cor.Y##rcv#glmnet 0.5780933 0.5660003
## Max.cor.Y##rcv#rpart 0.5780933 0.5440283
## Random###myrandom_classfr 0.5780933 0.5142038
## MFO###myMFO_classfr 0.5780933 0.5000000
## Final.All.X##rcv#glmnet NA NA
## max.AUCpROC.OOB min.elapsedtime.everything
## Low.cor.X##rcv#glmnet 0.5370867 14.978
## All.X##rcv#glmnet 0.5370867 15.017
## All.X##rcv#glm 0.5297993 6.627
## Max.cor.Y.rcv.1X1###glmnet 0.5332490 0.807
## Interact.High.cor.Y##rcv#glmnet 0.5326586 2.243
## Max.cor.Y##rcv#rpart 0.5326586 1.549
## Random###myrandom_classfr 0.4988023 0.397
## MFO###myMFO_classfr 0.5000000 0.580
## Final.All.X##rcv#glmnet NA 17.861
## max.Accuracy.fit opt.prob.threshold.fit
## Low.cor.X##rcv#glmnet 0.6037574 0.55
## All.X##rcv#glmnet 0.6037574 0.55
## All.X##rcv#glm 0.5445999 0.50
## Max.cor.Y.rcv.1X1###glmnet 0.6190234 0.55
## Interact.High.cor.Y##rcv#glmnet 0.6168144 0.50
## Max.cor.Y##rcv#rpart 0.6174930 0.50
## Random###myrandom_classfr 0.5778230 0.40
## MFO###myMFO_classfr 0.5778230 0.40
## Final.All.X##rcv#glmnet 0.5973970 0.55
## opt.prob.threshold.OOB
## Low.cor.X##rcv#glmnet 0.45
## All.X##rcv#glmnet 0.45
## All.X##rcv#glm 0.15
## Max.cor.Y.rcv.1X1###glmnet 0.40
## Interact.High.cor.Y##rcv#glmnet 0.40
## Max.cor.Y##rcv#rpart 0.40
## Random###myrandom_classfr 0.40
## MFO###myMFO_classfr 0.40
## Final.All.X##rcv#glmnet NA
## [1] "All.X##rcv#glmnet OOB confusion matrix & accuracy: "
## Prediction
## Reference D R
## D 20 188
## R 15 270
## err.abs.fit.sum err.abs.OOB.sum err.abs.trn.sum err.abs.new.sum
## No 914.5756 234.7403 1150.642 NA
## .freqRatio.Fit .freqRatio.OOB .freqRatio.Tst .n.Fit .n.New.D .n.New.R
## No 1 1 1 1966 33 589
## .n.OOB .n.Trn.D .n.Trn.R .n.Tst .n.fit .n.new .n.trn err.abs.OOB.mean
## No 493 1038 1421 622 1966 622 2459 0.4761466
## err.abs.fit.mean err.abs.new.mean err.abs.trn.mean
## No 0.4651961 NA 0.4679309
## err.abs.fit.sum err.abs.OOB.sum err.abs.trn.sum err.abs.new.sum
## 914.5755991 234.7402522 1150.6422008 NA
## .freqRatio.Fit .freqRatio.OOB .freqRatio.Tst .n.Fit
## 1.0000000 1.0000000 1.0000000 1966.0000000
## .n.New.D .n.New.R .n.OOB .n.Trn.D
## 33.0000000 589.0000000 493.0000000 1038.0000000
## .n.Trn.R .n.Tst .n.fit .n.new
## 1421.0000000 622.0000000 1966.0000000 622.0000000
## .n.trn err.abs.OOB.mean err.abs.fit.mean err.abs.new.mean
## 2459.0000000 0.4761466 0.4651961 NA
## err.abs.trn.mean
## 0.4679309
## [1] "Features Importance for selected models:"
## All.X..rcv.glmnet.imp
## Hhold.fctrPKn 100.00000
## Q115611.fctrNo 74.83104
## Q113181.fctrNo 71.92175
## Q115611.fctrYes 70.42909
## Q98869.fctrNo 66.61290
## Q101163.fctrDad 62.46552
## Q113181.fctrYes 55.51710
## Q116881.fctrRight 49.42789
## Q99480.fctrNo 43.25342
## Q109244.fctrNo:.clusterid.fctr2 39.55891
## Q98197.fctrYes 30.28896
## Q120472.fctrScience 28.69665
## Hhold.fctrPKy 27.22693
## Q108855.fctrYes! 20.85451
## Q106272.fctrNo 20.66949
## Q110740.fctrPC 20.23804
## Q98197.fctrNo 16.49085
## YOB.Age.fctr^6 15.71726
## Hhold.fctrMKy 15.15250
## Q116953.fctrNo 14.75715
## Q106997.fctrGr 0.00000
## Income.fctr.Q 0.00000
## Final.All.X..rcv.glmnet.imp
## Hhold.fctrPKn 100.000000
## Q115611.fctrNo 34.272514
## Q113181.fctrNo 58.066800
## Q115611.fctrYes 75.958431
## Q98869.fctrNo 37.501626
## Q101163.fctrDad 41.197966
## Q113181.fctrYes 22.193770
## Q116881.fctrRight 56.180154
## Q99480.fctrNo 23.808496
## Q109244.fctrNo:.clusterid.fctr2 24.178851
## Q98197.fctrYes 0.000000
## Q120472.fctrScience 1.778150
## Hhold.fctrPKy 11.162236
## Q108855.fctrYes! 15.054634
## Q106272.fctrNo 10.817868
## Q110740.fctrPC 22.924082
## Q98197.fctrNo 57.850515
## YOB.Age.fctr^6 0.000000
## Hhold.fctrMKy 18.578708
## Q116953.fctrNo 1.214709
## Q106997.fctrGr 20.363764
## Income.fctr.Q 12.681612
## [1] "glbObsNew prediction stats:"
##
## D R
## 33 589
## label step_major step_minor label_minor bgn end
## 22 predict.data.new 10 0 0 466.884 479.128
## 23 display.session.info 11 0 0 479.129 NA
## elapsed
## 22 12.244
## 23 NA
Null Hypothesis (\(\sf{H_{0}}\)): mpg is not impacted by am_fctr.
The variance by am_fctr appears to be independent. #{r q1, cache=FALSE} # print(t.test(subset(cars_df, am_fctr == "automatic")$mpg, # subset(cars_df, am_fctr == "manual")$mpg, # var.equal=FALSE)$conf) # We reject the null hypothesis i.e. we have evidence to conclude that am_fctr impacts mpg (95% confidence). Manual transmission is better for miles per gallon versus automatic transmission.
## label step_major step_minor label_minor bgn
## 2 inspect.data 2 0 0 13.729
## 13 cluster.data 5 0 0 199.194
## 16 fit.models 8 0 0 302.157
## 17 fit.models 8 1 1 370.651
## 3 scrub.data 2 1 1 160.470
## 14 partition.data.training 6 0 0 270.858
## 20 fit.data.training 9 0 0 433.297
## 22 predict.data.new 10 0 0 466.884
## 18 fit.models 8 2 2 421.026
## 21 fit.data.training 9 1 1 459.566
## 1 import.data 1 0 0 6.566
## 15 select.features 7 0 0 297.456
## 19 fit.models 8 3 3 430.230
## 11 extract.features.end 3 6 6 197.610
## 12 manage.missing.data 4 0 0 198.544
## 10 extract.features.string 3 5 5 197.543
## 9 extract.features.text 3 4 4 197.486
## 7 extract.features.image 3 2 2 197.396
## 4 transform.data 2 2 2 197.293
## 6 extract.features.datetime 3 1 1 197.356
## 8 extract.features.price 3 3 3 197.450
## 5 extract.features 3 0 0 197.335
## end elapsed duration
## 2 160.469 146.740 146.740
## 13 270.857 71.664 71.663
## 16 370.650 68.493 68.493
## 17 421.026 50.375 50.375
## 3 197.292 36.822 36.822
## 14 297.455 26.597 26.597
## 20 459.565 26.268 26.268
## 22 479.128 12.244 12.244
## 18 430.229 9.203 9.203
## 21 466.883 7.318 7.317
## 1 13.729 7.163 7.163
## 15 302.156 4.700 4.700
## 19 433.296 3.067 3.066
## 11 198.543 0.933 0.933
## 12 199.193 0.650 0.649
## 10 197.609 0.066 0.066
## 9 197.542 0.056 0.056
## 7 197.449 0.053 0.053
## 4 197.335 0.042 0.042
## 6 197.396 0.040 0.040
## 8 197.485 0.035 0.035
## 5 197.356 0.021 0.021
## [1] "Total Elapsed Time: 479.128 secs"